From 98654634ca0bf5d9e24af367765ed2a5ef848576 Mon Sep 17 00:00:00 2001 From: LYK Date: Tue, 7 Mar 2023 23:58:26 +0900 Subject: [PATCH] Update test/test_userstring.py from CPython 3.11.2 --- Lib/test/test_userstring.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py index 188c59e26d..c0017794e8 100644 --- a/Lib/test/test_userstring.py +++ b/Lib/test/test_userstring.py @@ -14,12 +14,6 @@ class UserStringTest( type2test = UserString - def test_removeprefix(self): - super().test_removeprefix() - - def test_removesuffix(self): - super().test_removesuffix() - # Overwrite the three testing methods, because UserString # can't cope with arguments propagated to UserString # (and we don't test with subclasses) @@ -33,12 +27,14 @@ def checkequal(self, result, object, methodname, *args, **kwargs): realresult ) - def checkraises(self, exc, obj, methodname, *args): + def checkraises(self, exc, obj, methodname, *args, expected_msg=None): obj = self.fixtype(obj) # we don't fix the arguments, because UserString can't cope with it with self.assertRaises(exc) as cm: getattr(obj, methodname)(*args) self.assertNotEqual(str(cm.exception), '') + if expected_msg is not None: + self.assertEqual(str(cm.exception), expected_msg) def checkcall(self, object, methodname, *args): object = self.fixtype(object)