File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import tempfile
1111import warnings
1212import weakref
13+ from textwrap import dedent
1314
1415import doctest
1516import unittest
16- from textwrap import dedent
1717from test import support
1818from test .support import import_helper , os_helper
1919
@@ -746,15 +746,12 @@ def test_invocation(self):
746746 self .assertListEqual (res .splitlines (), expect .splitlines ())
747747
748748 def test_unknown_flag (self ):
749- output = io .StringIO ()
749+ stderr = io .StringIO ()
750750 with self .assertRaises (SystemExit ):
751- # suppress argparse error message
752- with contextlib .redirect_stderr (output ):
751+ # check that the parser help is shown
752+ with contextlib .redirect_stderr (stderr ):
753753 _ = 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 } " )
754+ self .assertStartsWith (stderr .getvalue (), 'usage: ' )
758755
759756
760757def load_tests (loader , tests , pattern ):
You can’t perform that action at this time.
0 commit comments