Skip to content

Commit b95ca87

Browse files
committed
chore: more tests
1 parent a2d50cf commit b95ca87

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

packages/cubejs-backend-native/test/__snapshots__/jinja.test.ts.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ exports[`Jinja (new api) render arguments-test.yml.jinja: arguments-test.yml.jin
186186
arg_seq_2: [5,4,3,2,1]
187187
arg_sum_tuple: 3
188188
arg_sum_map: 20
189-
arg_kwargs: \\"arg1: first value, arg2: second value, kwarg:(3 arg4 arg)\\""
189+
arg_kwargs1: \\"arg1: first value, arg2: second value, kwarg:(3 arg)\\"
190+
arg_kwargs2: \\"arg1: first value, arg2: second value, kwarg:(3 arg,4 arg)\\"
191+
arg_kwargs3: \\"arg1: first value, arg2: second value, kwarg:(3 arg,4 arg,4 arg)\\""
190192
`;
191193

192194
exports[`Jinja (new api) render data-model.yml.jinja: data-model.yml.jinja 1`] = `
@@ -250,7 +252,7 @@ dump:
250252
exports[`Jinja (new api) render template_error_python.jinja: template_error_python.jinja 1`] = `
251253
[Error: could not render block: Call error: Python error: Exception: Random Exception
252254
Traceback (most recent call last):
253-
File "jinja-instance.py", line 119, in throw_exception
255+
File "jinja-instance.py", line 116, in throw_exception
254256
255257
------------------------- template_error_python.jinja -------------------------
256258
3 | 3

packages/cubejs-backend-native/test/templates/arguments-test.yml.jinja

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ test:
1515
arg_seq_2: {{ arg_seq(my_sequence_2) }}
1616
arg_sum_tuple: {{ arg_sum_tuple(my_int_tuple) }}
1717
arg_sum_map: {{ arg_sum_map(my_map) }}
18-
arg_kwargs: {{ arg_kwargs("first value", "second value", three="3 arg", four="4 arg") }}
18+
arg_kwargs1: {{ arg_kwargs("first value", "second value", three="3 arg") }}
19+
arg_kwargs2: {{ arg_kwargs("first value", "second value", three="3 arg", four="4 arg") }}
20+
arg_kwargs3: {{ arg_kwargs("first value", "second value", three="3 arg", four="4 arg", five="4 arg") }}

packages/cubejs-backend-native/test/templates/jinja-instance.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ def arg_sum_map(obj):
3535

3636
@template.function
3737
def arg_kwargs(arg1, arg2, **kwargs):
38-
kwargs_str = ""
39-
40-
for arg in kwargs.values():
41-
kwargs_str += arg
38+
kwargs_str = ",".join(kwargs.values())
4239

4340
return "arg1: " + arg1 + ", arg2: " + arg2 + ", kwarg:(" + kwargs_str + ")"
4441

0 commit comments

Comments
 (0)