diff --git a/tests/test_object_proxy.py b/tests/test_object_proxy.py index 19deffed..2c9f631b 100644 --- a/tests/test_object_proxy.py +++ b/tests/test_object_proxy.py @@ -2,8 +2,8 @@ import unittest import types -import operator import sys +import re is_pypy = '__pypy__' in sys.builtin_module_names @@ -1878,12 +1878,12 @@ def __init__(self, *args, **kwargs): with self.assertRaises(TypeError) as e: Object(self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) with self.assertRaises(TypeError) as e: wrapt.wrappers.CallableObjectProxy(Object)(self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) def test_self_keyword_argument_on_class_init_2(self): class Object: @@ -1894,12 +1894,12 @@ def __init__(self, *args, **kwargs): with self.assertRaises(TypeError) as e: Object(arg1='arg1', self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) with self.assertRaises(TypeError) as e: wrapt.wrappers.CallableObjectProxy(Object)(arg1='arg1', self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) def test_self_keyword_argument_on_class_init_renamed(self): class Object: @@ -2020,14 +2020,14 @@ def __init__(self, *args, **kwargs): with self.assertRaises(TypeError) as e: Object(self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, self='self') with self.assertRaises(TypeError) as e: o = wrapper() - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) def test_self_keyword_argument_on_class_init_1b(self): class Object: @@ -2038,14 +2038,14 @@ def __init__(self, *args, **kwargs): with self.assertRaises(TypeError) as e: Object(self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object) with self.assertRaises(TypeError) as e: o = wrapper(self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) def test_self_keyword_argument_on_class_init_2a(self): class Object: @@ -2056,14 +2056,14 @@ def __init__(self, *args, **kwargs): with self.assertRaises(TypeError) as e: Object(arg1='arg1', self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, arg1='arg1', self='self') with self.assertRaises(TypeError) as e: o = wrapper() - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) def test_self_keyword_argument_on_class_init_2b(self): class Object: @@ -2074,14 +2074,14 @@ def __init__(self, *args, **kwargs): with self.assertRaises(TypeError) as e: Object(arg1='arg1', self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object) with self.assertRaises(TypeError) as e: o = wrapper(arg1='arg1', self='self') - self.assertTrue("got multiple values for argument 'self'" in str(e.exception)) + self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None) def test_self_keyword_argument_on_class_init_renamed_1(self): class Object: