We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 230e256 commit 864f656Copy full SHA for 864f656
1 file changed
Lib/test/test_pickle.py
@@ -746,12 +746,15 @@ def test_invocation(self):
746
self.assertListEqual(res.splitlines(), expect.splitlines())
747
748
def test_unknown_flag(self):
749
- data = 'some_text'
750
- self.set_pickle_data(data)
+ output = io.StringIO()
751
with self.assertRaises(SystemExit):
752
# suppress argparse error message
753
- with contextlib.redirect_stderr(io.StringIO()):
+ with contextlib.redirect_stderr(output):
754
_ = self.invoke_pickle('--unknown')
+ msg = output.getvalue()
755
+ self.assertTrue(msg.startswith('usage: '),
756
+ "Output does not start with 'usage: '. "
757
+ f"Output was: {msg}")
758
759
760
def load_tests(loader, tests, pattern):
0 commit comments