@@ -21,16 +21,19 @@ def test_pyversion():
2121 assert isinstance (pyversion , int )
2222
2323
24- @pytest .mark .parametrize ("value, expects" , [
25- (12345 , "12345" ),
26- (123.45 , "123.45" ),
27- ([123.45 ], "[123.45]" ),
28- ({123.45 }, "{123.45}" ),
29- ((123.45 , ), "(123.45,)" ),
30- (None , "" ),
31- (pathlib .Path ("." ), "." ),
32- (decimal .Decimal ("1234" ), "1234" ),
33- ])
24+ @pytest .mark .parametrize (
25+ "value, expects" ,
26+ [
27+ (12345 , "12345" ),
28+ (123.45 , "123.45" ),
29+ ([123.45 ], "[123.45]" ),
30+ ({123.45 }, "{123.45}" ),
31+ ((123.45 , ), "(123.45,)" ),
32+ (None , "" ),
33+ (pathlib .Path ("." ), "." ),
34+ (decimal .Decimal ("1234" ), "1234" ),
35+ ]
36+ )
3437def test_as_text (value , expects ):
3538 assert utils .as_text (value ) == expects
3639
@@ -69,15 +72,19 @@ def test_chunks():
6972 assert list (chunks (list (range (100 )), 5 ))[0 ] == [0 , 1 , 2 , 3 , 4 ]
7073 assert list (chunks (["a" , "b" , "c" ], 1 )) == [["a" ], ["b" ], ["c" ]]
7174
75+
7276# TODO: cmp
7377
7478
75- @pytest .mark .parametrize ("value, expects" , [
76- ([1 , 2 , 3 ], "1,2,3" ),
77- (["a" , "b" , "c" ], "a,b,c" ),
78- (["a" , "b" , 1 , 2 ], "a,b,1,2" ),
79- (["a" , 2 , pathlib .Path ("foo.txt" )], "a,2,foo.txt" ),
80- ])
79+ @pytest .mark .parametrize (
80+ "value, expects" ,
81+ [
82+ ([1 , 2 , 3 ], "1,2,3" ),
83+ (["a" , "b" , "c" ], "a,b,c" ),
84+ (["a" , "b" , 1 , 2 ], "a,b,1,2" ),
85+ (["a" , 2 , pathlib .Path ("foo.txt" )], "a,2,foo.txt" ),
86+ ]
87+ )
8188def test_list2str (value , expects ):
8289 str_representation = list2str (value )
8390 assert isinstance (str_representation , str )
@@ -88,12 +95,15 @@ def test_list2str(value, expects):
8895 assert str_representation == expects
8996
9097
91- @pytest .mark .parametrize ("value, expects" , [
92- ([1 , 2 , 3 ], "1;2;3" ),
93- (["a" , "b" , "c" ], "a;b;c" ),
94- (["a" , "b" , 1 , 2 ], "a;b;1;2" ),
95- (["a" , 2 , pathlib .Path ("foo.txt" )], "a;2;foo.txt" ),
96- ])
98+ @pytest .mark .parametrize (
99+ "value, expects" ,
100+ [
101+ ([1 , 2 , 3 ], "1;2;3" ),
102+ (["a" , "b" , "c" ], "a;b;c" ),
103+ (["a" , "b" , 1 , 2 ], "a;b;1;2" ),
104+ (["a" , 2 , pathlib .Path ("foo.txt" )], "a;2;foo.txt" ),
105+ ]
106+ )
97107def test_list2str_semicolon (value , expects ):
98108 str_representation = list2str (value , sep = ";" )
99109 assert isinstance (str_representation , str )
@@ -159,6 +169,7 @@ def test_permutations():
159169
160170
161171class CustomRepr :
172+
162173 def __init__ (self ):
163174 pass
164175
@@ -167,6 +178,7 @@ def __repr__(self):
167178
168179
169180class NoRepr :
181+
170182 def __init__ (self ):
171183 pass
172184
@@ -211,19 +223,25 @@ def test_split_len():
211223 assert utils .split_len ("Spam Spam Spam Spam Spam Spam Spam Spam " , 5 ) == ["Spam " ] * 8
212224
213225
214- @pytest .mark .parametrize ("value, expects" , [
215- ("1,2,3" , (1 , 2 , 3 )), # tests without spaces
216- ("1, 2, 3" , (1 , 2 , 3 )), # tests with spaces
217- ])
226+ @pytest .mark .parametrize (
227+ "value, expects" ,
228+ [
229+ ("1,2,3" , (1 , 2 , 3 )), # tests without spaces
230+ ("1, 2, 3" , (1 , 2 , 3 )), # tests with spaces
231+ ]
232+ )
218233def test_str2tuple (value , expects ):
219234 assert isinstance (str2tuple (value ), tuple )
220235 assert str2tuple (value ) == expects
221236
222237
223- @pytest .mark .parametrize ("value, expects" , [
224- ("1;2;3" , (1 , 2 , 3 )), # tests without semicolon
225- ("1; 2; 3" , (1 , 2 , 3 )), # tests with semicolon
226- ])
238+ @pytest .mark .parametrize (
239+ "value, expects" ,
240+ [
241+ ("1;2;3" , (1 , 2 , 3 )), # tests without semicolon
242+ ("1; 2; 3" , (1 , 2 , 3 )), # tests with semicolon
243+ ]
244+ )
227245def test_str2tuple_semicolon (value , expects ):
228246 assert isinstance (str2tuple (value , sep = ";" ), tuple )
229247 assert str2tuple (value , sep = ";" ) == expects
0 commit comments