@@ -29,20 +29,6 @@ def test_get_missing_value_from_config():
2929 assert val is None
3030
3131
32- @pytest .mark .parametrize (
33- "valid_types, expected_value" ,
34- [
35- pytest .param ((str ,), "1234J" , id = "test_value_is_a_string_if_valid_types_is_str" ),
36- pytest .param (None , 1234j , id = "test_value_is_interpreted_as_complex_number_by_default" ),
37- ],
38- )
39- def test_get_value_with_complex_number (valid_types , expected_value ):
40- s = "{{ config['value'] }}"
41- config = {"value" : "1234J" }
42- val = interpolation .eval (s , config , valid_types = valid_types )
43- assert val == expected_value
44-
45-
4632def test_get_value_from_stream_slice ():
4733 s = "{{ stream_slice['date'] }}"
4834 config = {"date" : "2022-01-01" }
@@ -357,3 +343,21 @@ def test_interpolation_private_partition_attribute():
357343 actual_output = JinjaInterpolation ().eval (template , {}, ** {"stream_slice" : stream_slice })
358344
359345 assert actual_output == expected_output
346+
347+
348+ def test_given_complex_when_eval_then_return_string ():
349+ s = "9173710294242221J"
350+ config = {}
351+
352+ val = interpolation .eval (s , config )
353+
354+ assert isinstance (val , str )
355+
356+
357+ def test_given_valid_type_complex_when_eval_then_return_string ():
358+ s = "9173710294242221J"
359+ config = {}
360+
361+ val = interpolation .eval (s , config , valid_types = (complex ,))
362+
363+ assert isinstance (val , complex )
0 commit comments