@@ -40,7 +40,18 @@ def test_group():
40
40
assert _get_words (cli , [], "-" ) == ["-a" , "--help" ]
41
41
42
42
43
- def test_nested_group ():
43
+ @pytest .mark .parametrize (
44
+ ("args" , "word" , "expect" ),
45
+ [
46
+ ([], "" , ["get" ]),
47
+ (["get" ], "" , ["full" ]),
48
+ (["get" , "full" ], "" , ["data" ]),
49
+ (["get" , "full" ], "-" , ["--verbose" , "--help" ]),
50
+ (["get" , "full" , "data" ], "" , []),
51
+ (["get" , "full" , "data" ], "-" , ["-a" , "--help" ]),
52
+ ],
53
+ )
54
+ def test_nested_group (args : list [str ], word : str , expect : list [str ]) -> None :
44
55
cli = Group (
45
56
"cli" ,
46
57
commands = [
@@ -56,12 +67,7 @@ def test_nested_group():
56
67
)
57
68
],
58
69
)
59
- assert _get_words (cli , [], "" ) == ["get" ]
60
- assert _get_words (cli , ["get" ], "" ) == ["full" ]
61
- assert _get_words (cli , ["get" , "full" ], "" ) == ["data" ]
62
- assert _get_words (cli , ["get" , "full" ], "-" ) == ["--verbose" , "--help" ]
63
- assert _get_words (cli , ["get" , "full" , "data" ], "" ) == []
64
- assert _get_words (cli , ["get" , "full" , "data" ], "-" ) == ["-a" , "--help" ]
70
+ assert _get_words (cli , args , word ) == expect
65
71
66
72
67
73
def test_group_command_same_option ():
0 commit comments