diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-04-07 15:56:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-07 15:56:12 (GMT) |
commit | 150cd1916a59e750ce88c65325de9ef0c42c6cb5 (patch) | |
tree | 546e715a7883526a32430d58791636768724d755 /Lib/test | |
parent | fd0cd07a5a3c964c084f4efc5bbcb89dd2193ee6 (diff) | |
download | cpython-150cd1916a59e750ce88c65325de9ef0c42c6cb5.zip cpython-150cd1916a59e750ce88c65325de9ef0c42c6cb5.tar.gz cpython-150cd1916a59e750ce88c65325de9ef0c42c6cb5.tar.bz2 |
bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_tarfile.py | 10 | ||||
-rw-r--r-- | Lib/test/test_zipfile.py | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 561d5fc..030ace1 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -2167,6 +2167,16 @@ class CommandLineTest(unittest.TestCase): for tardata in files: tf.add(tardata, arcname=os.path.basename(tardata)) + def test_bad_use(self): + rc, out, err = self.tarfilecmd_failure() + self.assertEqual(out, b'') + self.assertIn(b'usage', err.lower()) + self.assertIn(b'error', err.lower()) + self.assertIn(b'required', err.lower()) + rc, out, err = self.tarfilecmd_failure('-l', '') + self.assertEqual(out, b'') + self.assertNotEqual(err.strip(), b'') + def test_test_command(self): for tar_name in testtarnames: for opt in '-t', '--test': diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 47436e5..46a67d5 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -2140,6 +2140,16 @@ class CommandLineTest(unittest.TestCase): def zipfilecmd_failure(self, *args): return script_helper.assert_python_failure('-m', 'zipfile', *args) + def test_bad_use(self): + rc, out, err = self.zipfilecmd_failure() + self.assertEqual(out, b'') + self.assertIn(b'usage', err.lower()) + self.assertIn(b'error', err.lower()) + self.assertIn(b'required', err.lower()) + rc, out, err = self.zipfilecmd_failure('-l', '') + self.assertEqual(out, b'') + self.assertNotEqual(err.strip(), b'') + def test_test_command(self): zip_name = findfile('zipdir.zip') for opt in '-t', '--test': |