From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 16 Aug 2024 07:41:49 +0000 (+0200) Subject: [3.13] gh-123046: Fix regexp to catch cases where the module name is omitted from... X-Git-Tag: v3.13.0rc2~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a604b2440ffcca897a524ea3ac0e24e9894ae615;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-123046: Fix regexp to catch cases where the module name is omitted from the weakref repr (GH-123047) (#123058) gh-123046: Fix regexp to catch cases where the module name is omitted from the weakref repr (GH-123047) (cherry picked from commit 786cac0c64dc156dfee817e87f15ae56b7e3ed00) Co-authored-by: Kirill Podoprigora Co-authored-by: sobolevn --- diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index ef2fe92cc219..1a820d089d66 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()