@@ -59,9 +59,9 @@ def test_search_args(self):
5959 '--ignore=.vscode,.idea' ]
6060 sys .argv [1 :] = options [2 :]
6161 parser = CodeCounterArgsParser ()
62- self .assertTrue ( 'config' not in parser .args , '"config" is in the "args"' )
63- self .assertTrue ('search' in parser .args , '"search" is not in the "args"' )
64- search_args = parser .args [ ' search' ]
62+ self .assertFalse ( parser .has_config_args () , '"config" is in the "args"' )
63+ self .assertTrue (parser .has_search_args () , '"search" is not in the "args"' )
64+ search_args = parser .search ()
6565 self .assertEqual (search_args .input_path , ['../code_counter/' ], "search path parsed error." )
6666 self .assertTrue (search_args .verbose , '-v,--verbose flag parsed error.' )
6767 self .assertTrue (search_args .graph , '-g,--graph flag parsed error.' )
@@ -83,9 +83,9 @@ def test_config_args(self):
8383 '--restore' ]
8484 sys .argv [1 :] = options [2 :]
8585 parser = CodeCounterArgsParser ()
86- self .assertTrue ('config' in parser .args , '"config" is not in the "args"' )
87- self .assertTrue ( 'search' not in parser .args , '"search" is in the "args"' )
88- config_args = parser .args [ ' config' ]
86+ self .assertTrue (parser .has_config_args () , '"config" is not in the "args"' )
87+ self .assertFalse ( parser .has_search_args () , '"search" is in the "args"' )
88+ config_args = parser .config ()
8989 self .assertTrue (config_args .show_list , '--list flag parsed error.' )
9090 self .assertEqual (config_args .suffix_add , ['lisp' ], "suffix_add flag and values parsed error." )
9191 self .assertEqual (config_args .suffix_reset , ['clj' ], "suffix_reset flag and values parsed error." )
@@ -103,11 +103,12 @@ def test_Config_restore(self, mock_input):
103103 'config' ,
104104 '--restore' ]
105105 sys .argv [1 :] = options [2 :]
106+
106107 parser = CodeCounterArgsParser ()
107- args = parser .args
108+ self .assertTrue (parser .has_config_args ())
109+
108110 config = Config ()
109- self .assertTrue ('config' in args )
110- config .invoke (args ['config' ])
111+ config .invoke (parser .config ())
111112
112113 self .assertEqual (config .suffix , self .default_suffix , "the suffix doesn't equal" )
113114 self .assertEqual (config .comment , self .default_comment , "the comment doesn't equal" )
@@ -126,10 +127,10 @@ def test_Config_reset1(self, mock_input):
126127 '--comment-reset=//,#,/**' ,
127128 '--ignore-reset=target,build,node_modules,__pycache__' ]
128129 sys .argv [1 :] = options [2 :]
130+
129131 parser = CodeCounterArgsParser ()
130- args = parser .args
131- self .assertTrue ('config' in args )
132- config .invoke (args ['config' ])
132+ self .assertTrue (parser .has_config_args ())
133+ config .invoke (parser .config ())
133134
134135 suffix = ['java' , 'cpp' , 'go' , 'js' , 'py' ]
135136 comment = ['//' , '#' , '/**' ]
@@ -154,10 +155,10 @@ def test_Config_reset2(self, mock_input):
154155 '--comment-reset=//,#,/**' ,
155156 '--ignore-reset=target,build,node_modules,__pycache__' ]
156157 sys .argv [1 :] = options [2 :]
158+
157159 parser = CodeCounterArgsParser ()
158- args = parser .args
159- self .assertTrue ('config' in args )
160- config .invoke (args ['config' ])
160+ self .assertTrue (parser .has_config_args ())
161+ config .invoke (parser .config ())
161162
162163 suffix = ['java' , 'cpp' , 'go' , 'js' , 'py' ]
163164 comment = ['//' , '#' , '/**' ]
@@ -182,10 +183,10 @@ def test_Config_reset3(self, mock_input):
182183 '--comment-reset=//,#,/**' ,
183184 '--ignore-reset=target,build,node_modules,__pycache__' ]
184185 sys .argv [1 :] = options [2 :]
186+
185187 parser = CodeCounterArgsParser ()
186- args = parser .args
187- self .assertTrue ('config' in args )
188- config .invoke (args ['config' ])
188+ self .assertTrue (parser .has_config_args ())
189+ config .invoke (parser .config ())
189190
190191 suffix = ['java' , 'cpp' , 'go' , 'js' , 'py' ]
191192 comment = ['//' , '#' , '/**' ]
@@ -210,10 +211,10 @@ def test_Config_reset4(self, mock_input):
210211 '--comment-reset=//,#,/**' ,
211212 '--ignore-reset=target,build,node_modules,__pycache__' ]
212213 sys .argv [1 :] = options [2 :]
214+
213215 parser = CodeCounterArgsParser ()
214- args = parser .args
215- self .assertTrue ('config' in args )
216- config .invoke (args ['config' ])
216+ self .assertTrue (parser .has_config_args ())
217+ config .invoke (parser .config ())
217218
218219 suffix = ['java' , 'cpp' , 'go' , 'js' , 'py' ]
219220 comment = ['//' , '#' , '/**' ]
@@ -238,10 +239,10 @@ def test_Config_add1(self, mock_input):
238239 '--comment-add=TEST_COMMENT' ,
239240 '--ignore-add=TEST_IGNORE' ]
240241 sys .argv [1 :] = options [2 :]
242+
241243 parser = CodeCounterArgsParser ()
242- args = parser .args
243- self .assertTrue ('config' in args )
244- config .invoke (args ['config' ])
244+ self .assertTrue (parser .has_config_args ())
245+ config .invoke (parser .config ())
245246
246247 suffix = 'TEST_SUFFIX'
247248 comment = 'TEST_COMMENT'
@@ -266,10 +267,10 @@ def test_Config_add2(self, mock_input):
266267 '--comment-add=TEST_COMMENT' ,
267268 '--ignore-add=TEST_IGNORE' ]
268269 sys .argv [1 :] = options [2 :]
270+
269271 parser = CodeCounterArgsParser ()
270- args = parser .args
271- self .assertTrue ('config' in args )
272- config .invoke (args ['config' ])
272+ self .assertTrue (parser .has_config_args ())
273+ config .invoke (parser .config ())
273274
274275 suffix = 'TEST_SUFFIX'
275276 comment = 'TEST_COMMENT'
@@ -322,10 +323,10 @@ def test_Config_add4(self, mock_input):
322323 '--comment-add=TEST_COMMENT' ,
323324 '--ignore-add=TEST_IGNORE' ]
324325 sys .argv [1 :] = options [2 :]
326+
325327 parser = CodeCounterArgsParser ()
326- args = parser .args
327- self .assertTrue ('config' in args )
328- config .invoke (args ['config' ])
328+ self .assertTrue (parser .has_config_args ())
329+ config .invoke (parser .config ())
329330
330331 suffix = 'TEST_SUFFIX'
331332 comment = 'TEST_COMMENT'
0 commit comments