From: Serhiy Storchaka Date: Thu, 19 Sep 2024 18:35:12 +0000 (+0300) Subject: gh-124245: Fix UserWarning in test_argparse (GH-124246) X-Git-Tag: v3.14.0a1~424 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=992e8f6102e317b4967a762fbefea82f9fcf9dfb;p=thirdparty%2FPython%2Fcpython.git gh-124245: Fix UserWarning in test_argparse (GH-124246) --- diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 584462b741ee..435db65d52fd 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -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