https://github.com/python/cpython/commit/1a8165012d41c77d1bece00673ff91fd37ec8dfc
commit: 1a8165012d41c77d1bece00673ff91fd37ec8dfc
branch: 3.11
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-02-14T14:04:23Z
summary:

[3.11] gh-115450: Fix direct invocation of `test_desctut` (GH-115451) (#115454)

gh-115450: Fix direct invocation of `test_desctut` (GH-115451)
(cherry picked from commit ec8909a23931338f81803ea3f18dc2073f74a152)

Co-authored-by: Nikita Sobolev <[email protected]>

files:
M Lib/test/test_descrtut.py

diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py
index 9aefda3d521b7d..dfe97ad5fe1d0f 100644
--- a/Lib/test/test_descrtut.py
+++ b/Lib/test/test_descrtut.py
@@ -40,16 +40,16 @@ def merge(self, other):
 Here's the new type at work:
 
     >>> print(defaultdict)              # show our type
-    <class 'test.test_descrtut.defaultdict'>
+    <class '%(modname)s.defaultdict'>
     >>> print(type(defaultdict))        # its metatype
     <class 'type'>
     >>> a = defaultdict(default=0.0)    # create an instance
     >>> print(a)                        # show the instance
     {}
     >>> print(type(a))                  # show its type
-    <class 'test.test_descrtut.defaultdict'>
+    <class '%(modname)s.defaultdict'>
     >>> print(a.__class__)              # show its class
-    <class 'test.test_descrtut.defaultdict'>
+    <class '%(modname)s.defaultdict'>
     >>> print(type(a) is a.__class__)   # its type is its class
     True
     >>> a[1] = 3.25                     # modify the instance
@@ -100,7 +100,7 @@ def merge(self, other):
     >>> print(sortdict(a.__dict__))
     {'default': -1000, 'x1': 100, 'x2': 200}
     >>>
-"""
+""" % {'modname': __name__}
 
 class defaultdict2(dict):
     __slots__ = ['default']
@@ -264,19 +264,19 @@ def merge(self, other):
     ...         print("classmethod", cls, y)
 
     >>> C.foo(1)
-    classmethod <class 'test.test_descrtut.C'> 1
+    classmethod <class '%(modname)s.C'> 1
     >>> c = C()
     >>> c.foo(1)
-    classmethod <class 'test.test_descrtut.C'> 1
+    classmethod <class '%(modname)s.C'> 1
 
     >>> class D(C):
     ...     pass
 
     >>> D.foo(1)
-    classmethod <class 'test.test_descrtut.D'> 1
+    classmethod <class '%(modname)s.D'> 1
     >>> d = D()
     >>> d.foo(1)
-    classmethod <class 'test.test_descrtut.D'> 1
+    classmethod <class '%(modname)s.D'> 1
 
 This prints "classmethod __main__.D 1" both times; in other words, the
 class passed as the first argument of foo() is the class involved in the
@@ -292,18 +292,18 @@ class passed as the first argument of foo() is the class 
involved in the
 
     >>> E.foo(1)
     E.foo() called
-    classmethod <class 'test.test_descrtut.C'> 1
+    classmethod <class '%(modname)s.C'> 1
     >>> e = E()
     >>> e.foo(1)
     E.foo() called
-    classmethod <class 'test.test_descrtut.C'> 1
+    classmethod <class '%(modname)s.C'> 1
 
 In this example, the call to C.foo() from E.foo() will see class C as its
 first argument, not class E. This is to be expected, since the call
 specifies the class C. But it stresses the difference between these class
 methods and methods defined in metaclasses (where an upcall to a metamethod
 would pass the target class as an explicit first argument).
-"""
+""" % {'modname': __name__}
 
 test_5 = """
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to