@@ -68,6 +68,60 @@ def test_parser_validate(self):
6868 text = st .getvalue ()
6969 self .assertIn ("mid" , text )
7070
71+ def test_parser_validate_cmd (self ):
72+ parser = get_parser_validate ()
73+ args = parser .parse_args (
74+ [
75+ "-m" ,
76+ "arnir0/Tiny-LLM" ,
77+ "--run" ,
78+ "-v" ,
79+ "1" ,
80+ "--mop" ,
81+ "cache_implementation=static" ,
82+ "--iop" ,
83+ "cls_cache=StaticCache" ,
84+ "--patch" ,
85+ ]
86+ )
87+ self .assertEqual (args .mid , "arnir0/Tiny-LLM" )
88+ self .assertEqual (args .run , True )
89+ self .assertEqual (args .patch , True )
90+ self .assertEqual (args .verbose , 1 )
91+ self .assertEqual (args .mop , {"cache_implementation" : "static" })
92+ self .assertEqual (args .iop , {"cls_cache" : "StaticCache" })
93+ args = parser .parse_args (
94+ [
95+ "-m" ,
96+ "arnir0/Tiny-LLM" ,
97+ "--run" ,
98+ "-v" ,
99+ "1" ,
100+ "--mop" ,
101+ "cache_implementation=static" ,
102+ "--iop" ,
103+ "cls_cache=StaticCache" ,
104+ "--patch" ,
105+ "patch_sympy=False" ,
106+ "--patch" ,
107+ "patch_torch=False" ,
108+ ]
109+ )
110+ self .assertEqual (args .mid , "arnir0/Tiny-LLM" )
111+ self .assertEqual (args .run , True )
112+ self .assertEqual (
113+ args .patch ,
114+ {
115+ "patch_diffusers" : True ,
116+ "patch_sympy" : False ,
117+ "patch_torch" : False ,
118+ "patch_transformers" : True ,
119+ },
120+ )
121+ self .assertEqual (args .verbose , 1 )
122+ self .assertEqual (args .mop , {"cache_implementation" : "static" })
123+ self .assertEqual (args .iop , {"cls_cache" : "StaticCache" })
124+
71125 def test_parser_stats (self ):
72126 st = StringIO ()
73127 with redirect_stdout (st ):
@@ -82,6 +136,26 @@ def test_parser_agg(self):
82136 text = st .getvalue ()
83137 self .assertIn ("--recent" , text )
84138
139+ def test_parser_agg_cmd (self ):
140+ parser = get_parser_agg ()
141+ args = parser .parse_args (
142+ [
143+ "o.xlsx" ,
144+ "*.zip" ,
145+ "--sbs" ,
146+ "dynamo:exporter=onnx-dynamo,opt=ir,attn_impl=eager" ,
147+ "--sbs" ,
148+ "custom:exporter=custom,opt=default,attn_impl=eager" ,
149+ ]
150+ )
151+ self .assertEqual (
152+ args .sbs ,
153+ {
154+ "custom" : {"attn_impl" : "eager" , "exporter" : "custom" , "opt" : "default" },
155+ "dynamo" : {"attn_impl" : "eager" , "exporter" : "onnx-dynamo" , "opt" : "ir" },
156+ },
157+ )
158+
85159 def test_parser_sbs (self ):
86160 st = StringIO ()
87161 with redirect_stdout (st ):
0 commit comments