From 46cb1ef457db30bdae88191fd4eaaf9c17ed3dea Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sat, 23 Jun 2012 18:11:59 +0200 Subject: Use non-deprecated speling. --- Lib/test/test_inspect.py | 88 ++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 7f70342..9d971e0 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -1348,20 +1348,20 @@ class TestSignatureObject(unittest.TestCase): S((po, pk, args, ko, kwargs)) - with self.assertRaisesRegexp(ValueError, 'wrong parameter order'): + with self.assertRaisesRegex(ValueError, 'wrong parameter order'): S((pk, po, args, ko, kwargs)) - with self.assertRaisesRegexp(ValueError, 'wrong parameter order'): + with self.assertRaisesRegex(ValueError, 'wrong parameter order'): S((po, args, pk, ko, kwargs)) - with self.assertRaisesRegexp(ValueError, 'wrong parameter order'): + with self.assertRaisesRegex(ValueError, 'wrong parameter order'): S((args, po, pk, ko, kwargs)) - with self.assertRaisesRegexp(ValueError, 'wrong parameter order'): + with self.assertRaisesRegex(ValueError, 'wrong parameter order'): S((po, pk, args, kwargs, ko)) kwargs2 = kwargs.replace(name='args') - with self.assertRaisesRegexp(ValueError, 'duplicate parameter name'): + with self.assertRaisesRegex(ValueError, 'duplicate parameter name'): S((po, pk, args, kwargs2, ko)) def test_signature_immutability(self): @@ -1409,24 +1409,24 @@ class TestSignatureObject(unittest.TestCase): ...)) def test_signature_on_builtin_function(self): - with self.assertRaisesRegexp(ValueError, 'not supported by signature'): + with self.assertRaisesRegex(ValueError, 'not supported by signature'): inspect.signature(type) - with self.assertRaisesRegexp(ValueError, 'not supported by signature'): + with self.assertRaisesRegex(ValueError, 'not supported by signature'): # support for 'wrapper_descriptor' inspect.signature(type.__call__) - with self.assertRaisesRegexp(ValueError, 'not supported by signature'): + with self.assertRaisesRegex(ValueError, 'not supported by signature'): # support for 'method-wrapper' inspect.signature(min.__call__) - with self.assertRaisesRegexp(ValueError, + with self.assertRaisesRegex(ValueError, 'no signature found for builtin function'): # support for 'method-wrapper' inspect.signature(min) def test_signature_on_non_function(self): - with self.assertRaisesRegexp(TypeError, 'is not a callable object'): + with self.assertRaisesRegex(TypeError, 'is not a callable object'): inspect.signature(42) - with self.assertRaisesRegexp(TypeError, 'is not a Python function'): + with self.assertRaisesRegex(TypeError, 'is not a Python function'): inspect.Signature.from_function(42) def test_signature_on_method(self): @@ -1485,10 +1485,10 @@ class TestSignatureObject(unittest.TestCase): self.assertEqual(self.signature(partial(test)), ((), ...)) - with self.assertRaisesRegexp(ValueError, "has incorrect arguments"): + with self.assertRaisesRegex(ValueError, "has incorrect arguments"): inspect.signature(partial(test, 1)) - with self.assertRaisesRegexp(ValueError, "has incorrect arguments"): + with self.assertRaisesRegex(ValueError, "has incorrect arguments"): inspect.signature(partial(test, a=1)) def test(a, b, *, c, d): @@ -1604,7 +1604,7 @@ class TestSignatureObject(unittest.TestCase): self.assertEqual(_foo(c=10), (1, 30, 10)) _foo = partial(_foo, 2) # now 'b' has two values - # positional and keyword - with self.assertRaisesRegexp(ValueError, "has incorrect arguments"): + with self.assertRaisesRegex(ValueError, "has incorrect arguments"): inspect.signature(_foo) def foo(a, b, c, *, d): @@ -1775,7 +1775,7 @@ class TestSignatureObject(unittest.TestCase): class Spam: pass - with self.assertRaisesRegexp(TypeError, "is not a callable object"): + with self.assertRaisesRegex(TypeError, "is not a callable object"): inspect.signature(Spam()) class Bar(Spam, Foo): @@ -1787,7 +1787,7 @@ class TestSignatureObject(unittest.TestCase): class ToFail: __call__ = type - with self.assertRaisesRegexp(ValueError, "not supported by signature"): + with self.assertRaisesRegex(ValueError, "not supported by signature"): inspect.signature(ToFail()) @@ -1850,7 +1850,7 @@ class TestSignatureObject(unittest.TestCase): def test_signature_unhashable(self): def foo(a): pass sig = inspect.signature(foo) - with self.assertRaisesRegexp(TypeError, 'unhashable type'): + with self.assertRaisesRegex(TypeError, 'unhashable type'): hash(sig) def test_signature_str(self): @@ -1920,27 +1920,27 @@ class TestParameterObject(unittest.TestCase): self.assertIs(p.annotation, p.empty) self.assertEqual(p.kind, inspect.Parameter.POSITIONAL_ONLY) - with self.assertRaisesRegexp(ValueError, 'invalid value'): + with self.assertRaisesRegex(ValueError, 'invalid value'): inspect.Parameter('foo', default=10, kind='123') - with self.assertRaisesRegexp(ValueError, 'not a valid parameter name'): + with self.assertRaisesRegex(ValueError, 'not a valid parameter name'): inspect.Parameter('1', kind=inspect.Parameter.VAR_KEYWORD) - with self.assertRaisesRegexp(ValueError, + with self.assertRaisesRegex(ValueError, 'non-positional-only parameter'): inspect.Parameter(None, kind=inspect.Parameter.VAR_KEYWORD) - with self.assertRaisesRegexp(ValueError, 'cannot have default values'): + with self.assertRaisesRegex(ValueError, 'cannot have default values'): inspect.Parameter('a', default=42, kind=inspect.Parameter.VAR_KEYWORD) - with self.assertRaisesRegexp(ValueError, 'cannot have default values'): + with self.assertRaisesRegex(ValueError, 'cannot have default values'): inspect.Parameter('a', default=42, kind=inspect.Parameter.VAR_POSITIONAL) p = inspect.Parameter('a', default=42, kind=inspect.Parameter.POSITIONAL_OR_KEYWORD) - with self.assertRaisesRegexp(ValueError, 'cannot have default values'): + with self.assertRaisesRegex(ValueError, 'cannot have default values'): p.replace(kind=inspect.Parameter.VAR_POSITIONAL) self.assertTrue(repr(p).startswith('