@@ -42,7 +42,7 @@ def test_check_dependencies(capsys):
4242 missing_deps = utils .check_dependencies (deps )
4343 captured = capsys .readouterr ()
4444 stdout = captured .out .split ("\n " )
45- assert stdout [0 ] == "The following modules are missing. "
45+ assert stdout [0 ] == "The following modules are missing: "
4646 assert stdout [1 ] == "['madeup_module']"
4747 assert stdout [2 ] == "Please check the documentation."
4848 assert stdout [3 ] == ''
@@ -333,28 +333,47 @@ def test_protocol_pandas(self):
333333 assert isinstance (pandas .DataFrame , HasHead )
334334 assert isinstance (pandas .Series , HasHead )
335335
336- def test_namedtuple (self ):
337- foo = namedtuple ("foo" , "a, b, c, d, e, f, g, h, i, j, k, l, m" )
338- assert head (
339- foo (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 )
340- ) == "foo(a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9, j=10, ...)"
341- assert head (
342- foo (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ), 13
343- ) == "foo(a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9, j=10, k=11, l=12, m=13)"
336+ foo = namedtuple ("foo" , "a, b, c, d, e, f, g, h, i, j, k, l, m" )
344337
345- def test_tuple (self ):
346- assert head ((1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 )) == "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...)"
347- assert head (
348- (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ),
349- 13 ,
350- ) == "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)"
338+ @pytest .mark .parametrize (
339+ "args, expects" ,
340+ [
341+ ((foo (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ), ),
342+ "foo(a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9, j=10, ...)" ),
343+ ((foo (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ), 13 ),
344+ "foo(a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9, j=10, k=11, l=12, m=13)" ),
345+ ]
346+ )
347+ def test_namedtuple (self , args , expects ):
348+ assert head (* args ) == expects
351349
352- def test_list (self ):
353- assert head ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ]) == "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]"
354- assert head (
355- [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ],
356- 13 ,
357- ) == "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]"
350+ @pytest .mark .parametrize (
351+ "args, expects" ,
352+ [
353+ (((1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ), ), "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...)" ),
354+ ((
355+ (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ),
356+ 13 ,
357+ ),
358+ "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)" ),
359+ ]
360+ )
361+ def test_tuple (self , args , expects ):
362+ assert head (* args ) == expects
363+
364+ @pytest .mark .parametrize (
365+ "args, expects" ,
366+ [
367+ (([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ], ), "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]" ),
368+ ((
369+ [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ],
370+ 13 ,
371+ ),
372+ "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]" ),
373+ ]
374+ )
375+ def test_list (self , args , expects ):
376+ assert head (* args ) == expects
358377
359378 def test_data_frame (self ):
360379 pandas = pytest .importorskip ("pandas" )
@@ -436,7 +455,7 @@ def deprecated_func(*args, **kwargs):
436455
437456
438457def test_diff (file_regression : FileRegressionFixture ):
439- data_dir = PathPlus (__file__ ).parent / "test_diff "
458+ data_dir = PathPlus (__file__ ).parent / "test_diff_ "
440459 original = data_dir / "original"
441460 modified = data_dir / "modified"
442461
0 commit comments