6
6
def test_value_is_str ():
7
7
assert Argument (name = "arg1" , value = "VALUE1" ).render () == "arg1: VALUE1"
8
8
assert Argument (name = "id" , value = '"1000"' ).render () == 'id: "1000"'
9
- assert Argument (name = "length" , value = ' 911' ).render () == ' length: 911'
9
+ assert Argument (name = "length" , value = " 911" ).render () == " length: 911"
10
10
assert Argument (name = "unit" , value = "null" ).render () == "unit: null"
11
11
12
12
13
13
def test_value_is_int ():
14
- assert Argument (name = "length" , value = 911 ).render () == ' length: 911'
15
- assert Argument (name = "length" , value = 0 ).render () == ' length: 0'
16
- assert Argument (name = "length" , value = - 1 ).render () == ' length: -1'
14
+ assert Argument (name = "length" , value = 911 ).render () == " length: 911"
15
+ assert Argument (name = "length" , value = 0 ).render () == " length: 0"
16
+ assert Argument (name = "length" , value = - 1 ).render () == " length: -1"
17
17
18
18
19
19
def test_value_is_bool ():
20
- assert Argument (name = "some" , value = True ).render () == ' some: true'
21
- assert Argument (name = "some" , value = False ).render () == ' some: false'
20
+ assert Argument (name = "some" , value = True ).render () == " some: true"
21
+ assert Argument (name = "some" , value = False ).render () == " some: false"
22
22
23
23
24
24
def test_value_is_float ():
25
- assert Argument (name = "some" , value = 1.0 ).render () == ' some: 1.0'
26
- assert Argument (name = "some" , value = 0.2 ).render () == ' some: 0.2'
25
+ assert Argument (name = "some" , value = 1.0 ).render () == " some: 1.0"
26
+ assert Argument (name = "some" , value = 0.2 ).render () == " some: 0.2"
27
27
28
28
29
- def test_value_is_list_str ():
29
+ def test_value_is_list_str_with_backward_compatible_workarounds ():
30
30
assert Argument (name = "someListArgument" , value = ['"123"' ]).render () == 'someListArgument: ["123"]'
31
- assert Argument (name = "someListArgument" , value = []).render () == ' someListArgument: []'
31
+ assert Argument (name = "someListArgument" , value = []).render () == " someListArgument: []"
32
32
assert Argument (name = "someListArgument" , value = ['"123", "456"' ]).render () == 'someListArgument: ["123", "456"]'
33
33
34
34
35
+ def test_value_is_list_str ():
36
+ assert Argument (name = "someListArgument" , value = ["123" , "456" ]).render () == 'someListArgument: ["123", "456"]'
37
+ assert (
38
+ Argument (name = "someListArgument" , value = ["hello" , "world" ]).render () == 'someListArgument: ["hello", "world"]'
39
+ )
40
+
41
+
42
+ def test_value_is_list_str_with_apostrophe ():
43
+ assert (
44
+ Argument (name = "someListArgument" , value = ["you'r" , "isn't" ]).render () == 'someListArgument: ["you\' r", "isn\' t"]'
45
+ )
46
+
47
+
35
48
def test_value_is_list_int ():
36
- assert Argument (name = "someListArgument" , value = [123 ]).render () == ' someListArgument: [123]'
37
- assert Argument (name = "someListArgument" , value = []).render () == ' someListArgument: []'
38
- assert Argument (name = "someListArgument" , value = [123 , 456 ]).render () == ' someListArgument: [123, 456]'
49
+ assert Argument (name = "someListArgument" , value = [123 ]).render () == " someListArgument: [123]"
50
+ assert Argument (name = "someListArgument" , value = []).render () == " someListArgument: []"
51
+ assert Argument (name = "someListArgument" , value = [123 , 456 ]).render () == " someListArgument: [123, 456]"
39
52
40
53
41
54
def test_value_is_list_bool ():
42
- assert Argument (name = "someListArgument" , value = [True , False ]).render () == ' someListArgument: [true, false]'
43
- assert Argument (name = "someListArgument" , value = [True ]).render () == ' someListArgument: [true]'
44
- assert Argument (name = "someListArgument" , value = [False ]).render () == ' someListArgument: [false]'
55
+ assert Argument (name = "someListArgument" , value = [True , False ]).render () == " someListArgument: [true, false]"
56
+ assert Argument (name = "someListArgument" , value = [True ]).render () == " someListArgument: [true]"
57
+ assert Argument (name = "someListArgument" , value = [False ]).render () == " someListArgument: [false]"
45
58
46
59
47
60
def test_value_is_list_float ():
48
- assert Argument (name = "someListArgument" , value = [1.0 , 0.2 ]).render () == ' someListArgument: [1.0, 0.2]'
49
- assert Argument (name = "someListArgument" , value = [42.0 ]).render () == ' someListArgument: [42.0]'
61
+ assert Argument (name = "someListArgument" , value = [1.0 , 0.2 ]).render () == " someListArgument: [1.0, 0.2]"
62
+ assert Argument (name = "someListArgument" , value = [42.0 ]).render () == " someListArgument: [42.0]"
50
63
51
64
52
65
@pytest .mark .parametrize (
@@ -62,7 +75,7 @@ def test_value_is_list_float():
62
75
Argument (name = "field" , value = ['"value1"' , '"value2"' ]),
63
76
'filter: {\n field: ["value1", "value2"]\n }' ,
64
77
),
65
- ("filter" , Argument (name = "field" , value = Variable (name = "var" , type = "Variable" )), ' filter: {\n field: $var\n }' ),
78
+ ("filter" , Argument (name = "field" , value = Variable (name = "var" , type = "Variable" )), " filter: {\n field: $var\n }" ),
66
79
],
67
80
)
68
81
def test_value_is_argument (name : str , value : Argument , result : str ):
@@ -73,7 +86,7 @@ def test_value_is_argument(name: str, value: Argument, result: str):
73
86
def test_value_is_variable ():
74
87
var = Variable (name = "var" , type = "Variable" )
75
88
arg = Argument (name = "field" , value = var )
76
- assert arg .render () == ' field: $var'
89
+ assert arg .render () == " field: $var"
77
90
78
91
79
92
def test_value_is_list_of_args ():
0 commit comments