diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_capi.py | 8 | ||||
-rw-r--r-- | Lib/test/test_exceptions.py | 2 | ||||
-rw-r--r-- | Lib/test/test_getargs2.py | 13 |
3 files changed, 12 insertions, 11 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 2a53f3d081f..6e14248a125 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -533,19 +533,19 @@ class SkipitemTest(unittest.TestCase): parse((1, 2, 3), {}, b'OOO', ['', '', 'a']) parse((1, 2), {'a': 3}, b'OOO', ['', '', 'a']) with self.assertRaisesRegex(TypeError, - r'Function takes at least 2 positional arguments \(1 given\)'): + r'function takes at least 2 positional arguments \(1 given\)'): parse((1,), {'a': 3}, b'OOO', ['', '', 'a']) parse((1,), {}, b'O|OO', ['', '', 'a']) with self.assertRaisesRegex(TypeError, - r'Function takes at least 1 positional arguments \(0 given\)'): + r'function takes at least 1 positional arguments \(0 given\)'): parse((), {}, b'O|OO', ['', '', 'a']) parse((1, 2), {'a': 3}, b'OO$O', ['', '', 'a']) with self.assertRaisesRegex(TypeError, - r'Function takes exactly 2 positional arguments \(1 given\)'): + r'function takes exactly 2 positional arguments \(1 given\)'): parse((1,), {'a': 3}, b'OO$O', ['', '', 'a']) parse((1,), {}, b'O|O$O', ['', '', 'a']) with self.assertRaisesRegex(TypeError, - r'Function takes at least 1 positional arguments \(0 given\)'): + r'function takes at least 1 positional arguments \(0 given\)'): parse((), {}, b'O|O$O', ['', '', 'a']) with self.assertRaisesRegex(SystemError, r'Empty parameter name after \$'): parse((1,), {}, b'O|$OO', ['', '', 'a']) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index e6fa34610d0..3378ceb701c 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1090,7 +1090,7 @@ class ImportErrorTests(unittest.TestCase): self.assertEqual(exc.name, 'somename') self.assertEqual(exc.path, 'somepath') - msg = "'invalid' is an invalid keyword argument for this function" + msg = "'invalid' is an invalid keyword argument for ImportError" with self.assertRaisesRegex(TypeError, msg): ImportError('test', invalid='keyword') diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py index e5d9aa64ee2..86df3a47504 100644 --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -553,7 +553,8 @@ class Keywords_TestCase(unittest.TestCase): try: getargs_keywords(arg1=(1,2)) except TypeError as err: - self.assertEqual(str(err), "Required argument 'arg2' (pos 2) not found") + self.assertEqual( + str(err), "function missing required argument 'arg2' (pos 2)") else: self.fail('TypeError should have been raised') @@ -626,16 +627,16 @@ class KeywordOnly_TestCase(unittest.TestCase): ) # required arg missing with self.assertRaisesRegex(TypeError, - r"Required argument 'required' \(pos 1\) not found"): + r"function missing required argument 'required' \(pos 1\)"): getargs_keyword_only(optional=2) with self.assertRaisesRegex(TypeError, - r"Required argument 'required' \(pos 1\) not found"): + r"function missing required argument 'required' \(pos 1\)"): getargs_keyword_only(keyword_only=3) def test_too_many_args(self): with self.assertRaisesRegex(TypeError, - r"Function takes at most 2 positional arguments \(3 given\)"): + r"function takes at most 2 positional arguments \(3 given\)"): getargs_keyword_only(1, 2, 3) with self.assertRaisesRegex(TypeError, @@ -674,11 +675,11 @@ class PositionalOnlyAndKeywords_TestCase(unittest.TestCase): self.assertEqual(self.getargs(1), (1, -1, -1)) # required positional arg missing with self.assertRaisesRegex(TypeError, - r"Function takes at least 1 positional arguments \(0 given\)"): + r"function takes at least 1 positional arguments \(0 given\)"): self.getargs() with self.assertRaisesRegex(TypeError, - r"Function takes at least 1 positional arguments \(0 given\)"): + r"function takes at least 1 positional arguments \(0 given\)"): self.getargs(keyword=3) def test_empty_keyword(self): |