コード例 #1
0
 def test_non_existing_dir_raises_argument_type_error(
         self, tmp_path_as_cwd):
     with pytest.raises(SystemExit), pytest.raises(
             argparse.ArgumentTypeError), mock.patch('sys.stderr'):
         params = ['--dump-log', 'non_existing_dir']
         Args(params)
コード例 #2
0
 def test_args_version_is_false_when_version_is_not_in_args_list(self):
     assert not Args([]).version
コード例 #3
0
 def test_args_dump_log_defaults_to_cwd(self):
     cwd: Path = Path()
     params = ['--dump-log']
     assert Args(params).dump_log == cwd
コード例 #4
0
 def test_args_dump_log_is_not_none_when_dump_log_dir_in_args_list(self):
     params = ['--dump-log', '.']
     assert Args(params).dump_log is not None
コード例 #5
0
 def test_unrecognized_arguments_raises_system_exit(self):
     with pytest.raises(SystemExit), mock.patch('sys.stderr'):
         Args(['--foo'])
コード例 #6
0
 def test_args_param_property_is_true_when_param_in_args_list(
         self, params, param_property):
     args: Any = Args(params)
     assert param_property.getter(args)
コード例 #7
0
 def test_expected_params(self, params):
     assert Args(params)