44
55
66@pytest .mark .parametrize (
7- "expected" ,
7+ "input, expected" ,
88 [
9+ # Pack with no examples
10+ {"empty_pack" : []},
11+ # Pack with multiple examples
912 {
10- # test with pack that has examples
11- "pack1" : [
12- "ex1" ,
13- "ex2" ,
14- "ex3" ,
13+ "full_pack" : [
14+ ("example1" , "path_to_1" ),
15+ ("example2" , "path_to_2" ),
1516 ]
1617 },
18+ # Multiple packs with examples
1719 {
18- # test pack with no examples
19- "no_examples " : []
20+ "pack1" : [( "ex1" , "path1" ), ( "ex2" , "path2" )],
21+ "pack2 " : [( "ex3" , "path3" )],
2022 },
23+ # No pack found
24+ {},
2125 ],
2226)
2327def test_available_examples (temp_path , expected ):
@@ -27,21 +31,22 @@ def test_available_examples(temp_path, expected):
2731 for ex in examples :
2832 ex_dir = pack_dir / ex
2933 ex_dir .mkdir (parents = True , exist_ok = True )
30- pkmg = PacksManager (temp_path )
34+ pkmg = PacksManager ()
3135 actual = pkmg .available_examples (temp_path )
3236 assert actual == expected
3337
3438
3539def test_available_examples_bad (temp_path ):
36- pkmg = PacksManager (temp_path )
40+ pkmg = PacksManager ()
3741 bad_path = temp_path / "nonexistent"
3842 with pytest .raises (FileNotFoundError ):
3943 pkmg .available_examples (bad_path )
4044
4145
4246def test_print_info (temp_path , capsys ):
43- pkmg = PacksManager (temp_path )
44- pkmg .print_info ()
47+ pkmg = PacksManager ()
48+ actual = pkmg .available_examples (temp_path )
49+ pkmg .print_info (actual )
4550 captured = capsys .readouterr ()
4651 output = captured .out .strip ()
4752 assert "Available packs" in output or "Installed packs" in output
0 commit comments