]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111155: Fix direct invocation of test_pprint (GH-111156)
authorNikita Sobolev <mail@sobolevn.me>
Sat, 21 Oct 2023 12:09:01 +0000 (15:09 +0300)
committerGitHub <noreply@github.com>
Sat, 21 Oct 2023 12:09:01 +0000 (15:09 +0300)
Lib/test/test_pprint.py

index 6ea7e7db2ce1132bd99c3e40c10cc57171830706..4d1766fb16ce9fa5bb12346dbf86fd2e22e9d2db 100644 (file)
@@ -7,6 +7,7 @@ import io
 import itertools
 import pprint
 import random
+import re
 import test.support
 import test.test_set
 import types
@@ -535,7 +536,10 @@ AdvancedNamespace(the=0,
     def test_dataclass_no_repr(self):
         dc = dataclass3()
         formatted = pprint.pformat(dc, width=10)
-        self.assertRegex(formatted, r"<test.test_pprint.dataclass3 object at \w+>")
+        self.assertRegex(
+            formatted,
+            fr"<{re.escape(__name__)}.dataclass3 object at \w+>",
+        )
 
     def test_recursive_dataclass(self):
         dc = dataclass4(None)