Skip to content

Commit 864f656

Browse files
committed
Add suggestion
1 parent 230e256 commit 864f656

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_pickle.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,12 +746,15 @@ def test_invocation(self):
746746
self.assertListEqual(res.splitlines(), expect.splitlines())
747747

748748
def test_unknown_flag(self):
749-
data = 'some_text'
750-
self.set_pickle_data(data)
749+
output = io.StringIO()
751750
with self.assertRaises(SystemExit):
752751
# suppress argparse error message
753-
with contextlib.redirect_stderr(io.StringIO()):
752+
with contextlib.redirect_stderr(output):
754753
_ = self.invoke_pickle('--unknown')
754+
msg = output.getvalue()
755+
self.assertTrue(msg.startswith('usage: '),
756+
"Output does not start with 'usage: '. "
757+
f"Output was: {msg}")
755758

756759

757760
def load_tests(loader, tests, pattern):

0 commit comments

Comments
 (0)