1010
1111
1212class Testjsoncsv (unittest .TestCase ):
13-
1413 def test_jsoncsv_expand (self ):
1514 runner = CliRunner ()
16- args = ['-e' , 'fixture/files/raw.0.json' , 'fixture/files/tmp.expand.0.json' ]
15+ args = ['-e' , 'fixture/files/raw.0.json' ,
16+ 'fixture/files/tmp.expand.0.json' ]
1717 result = runner .invoke (jsoncsv , args = args )
1818 assert result .exit_code == 0
1919
2020 def test_jsoncsv_expand_with_json_array (self ):
2121 runner = CliRunner ()
22- args = ['-e' , 'fixture/files/raw.1.json' , 'fixture/files/tmp.expand.1.json' , '-A' ]
22+ args = ['-e' , 'fixture/files/raw.1.json' ,
23+ 'fixture/files/tmp.expand.1.json' , '-A' ]
2324 result = runner .invoke (jsoncsv , args = args )
2425 assert result .exit_code == 0
2526
2627 def test_jsoncsv_expand_restore (self ):
2728 runner = CliRunner (echo_stdin = True )
28- result = runner .invoke (jsoncsv , args = ['-e' , 'fixture/files/raw.2.json' , 'fixture/files/tmp.expand.2.json' ])
29+ result = runner .invoke (jsoncsv ,
30+ args = ['-e' , 'fixture/files/raw.2.json' ,
31+ 'fixture/files/tmp.expand.2.json' ])
2932 assert result .exit_code == 0
30- result = runner .invoke (jsoncsv , args = ['-r' , 'fixture/files/tmp.expand.2.json' , 'fixture/files/tmp.restore.2.json' ])
33+ result = runner .invoke (jsoncsv ,
34+ args = ['-r' , 'fixture/files/tmp.expand.2.json' ,
35+ 'fixture/files/tmp.restore.2.json' ])
3136 assert result .exit_code == 0
3237
3338 with io .open ('fixture/files/raw.2.json' , 'r' ) as f :
@@ -37,3 +42,17 @@ def test_jsoncsv_expand_restore(self):
3742 resotre_data = [json .loads (line ) for line in f ]
3843
3944 self .assertEqual (input_data , resotre_data )
45+
46+ def test_jsoncsv_with_error_args (self ):
47+ runner = CliRunner ()
48+ args = ['-s' , 'aa' , '-e' , 'fixture/files/raw.0.json' ,
49+ 'fixture/files/tmp.expand.0.json' ]
50+ result = runner .invoke (jsoncsv , args = args )
51+ assert result .exit_code != 0
52+
53+ def test_jsoncsv_with_error_args_expand_and_restore (self ):
54+ runner = CliRunner ()
55+ args = ['-r' , '-e' , 'fixture/files/raw.0.json' ,
56+ 'fixture/files/tmp.expand.0.json' ]
57+ result = runner .invoke (jsoncsv , args = args )
58+ assert result .exit_code != 0
0 commit comments