]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-124245: Fix UserWarning in test_argparse (GH-124246)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 19 Sep 2024 18:35:12 +0000 (21:35 +0300)
committerGitHub <noreply@github.com>
Thu, 19 Sep 2024 18:35:12 +0000 (21:35 +0300)
Lib/test/test_argparse.py

index 584462b741ee9965b2343bc551f676408e4b1da9..435db65d52fddb1124b48550667e61f6d0106190 100644 (file)
@@ -5811,9 +5811,8 @@ class TestIntermixedArgs(TestCase):
         parser = ErrorRaisingArgumentParser(prog='PROG')
         parser.add_argument('--foo', nargs="*")
         parser.add_argument('foo')
-        with captured_stderr() as stderr:
+        with self.assertWarns(UserWarning):
             parser.parse_intermixed_args(['hello', '--foo'])
-            self.assertIn("UserWarning", stderr.getvalue())
 
 class TestIntermixedMessageContentError(TestCase):
     # case where Intermixed gives different error message