summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-10-21 12:09:01 (GMT)
committerGitHub <noreply@github.com>2023-10-21 12:09:01 (GMT)
commite136e2d640f4686b63ea05088d481115185fc305 (patch)
treec4d95083db971f2d216a9c8d55022c04f54b7c19
parent86276fe4f8e0801f1194b55fa8d8cb7dbf8ee658 (diff)
downloadcpython-e136e2d640f4686b63ea05088d481115185fc305.zip
cpython-e136e2d640f4686b63ea05088d481115185fc305.tar.gz
cpython-e136e2d640f4686b63ea05088d481115185fc305.tar.bz2
gh-111155: Fix direct invocation of test_pprint (GH-111156)
-rw-r--r--Lib/test/test_pprint.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py
index 6ea7e7d..4d1766f 100644
--- a/Lib/test/test_pprint.py
+++ b/Lib/test/test_pprint.py
@@ -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)