From: Kirill Podoprigora Date: Fri, 16 Aug 2024 07:14:53 +0000 (+0300) Subject: gh-123046: Fix regexp to catch cases where the module name is omitted from the weakre... X-Git-Tag: v3.14.0a1~766 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=786cac0c64dc156dfee817e87f15ae56b7e3ed00;p=thirdparty%2FPython%2Fcpython.git gh-123046: Fix regexp to catch cases where the module name is omitted from the weakref repr (#123047) Co-authored-by: sobolevn --- diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 2b9b2a04db82..023df68fca73 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -123,10 +123,12 @@ class ReferencesTestCase(TestBase): def test_ref_repr(self): obj = C() ref = weakref.ref(obj) - self.assertRegex(repr(ref), - rf"") + regex = ( + rf"" + ) + self.assertRegex(repr(ref), regex) obj = None gc_collect() @@ -141,10 +143,13 @@ class ReferencesTestCase(TestBase): obj2 = WithName() ref2 = weakref.ref(obj2) - self.assertRegex(repr(ref2), - rf"") + regex = ( + rf"" + ) + self.assertRegex(repr(ref2), regex) def test_repr_failure_gh99184(self): class MyConfig(dict): @@ -229,10 +234,12 @@ class ReferencesTestCase(TestBase): def test_proxy_repr(self): obj = C() ref = weakref.proxy(obj, self.callback) - self.assertRegex(repr(ref), - rf"") + regex = ( + rf"" + ) + self.assertRegex(repr(ref), regex) obj = None gc_collect()