summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_class.py
diff options
context:
space:
mode:
authorKushal Das <kushaldas@gmail.com>2016-06-04 23:21:13 (GMT)
committerKushal Das <kushaldas@gmail.com>2016-06-04 23:21:13 (GMT)
commit5801ecb4408cd11f6e6ffcb1612ca68d9936a728 (patch)
treed50a9aa79b55eb92dde2c12908d6ecb14fc7f1d5 /Lib/test/test_class.py
parent409482251b06fe75c4ee56e85ffbb4b23d934159 (diff)
downloadcpython-5801ecb4408cd11f6e6ffcb1612ca68d9936a728.zip
cpython-5801ecb4408cd11f6e6ffcb1612ca68d9936a728.tar.gz
cpython-5801ecb4408cd11f6e6ffcb1612ca68d9936a728.tar.bz2
Issue #25548: Showing memory address of class objects in repl
Diffstat (limited to 'Lib/test/test_class.py')
-rw-r--r--Lib/test/test_class.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 4d554a3..e02a3cb 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -568,5 +568,15 @@ class ClassTests(unittest.TestCase):
a = A(hash(A.f)^(-1))
hash(a.f)
+ def test_class_repr(self):
+ # We should get the address of the object
+ class A:
+ pass
+
+ result = repr(A)
+ self.assertRegex(result,
+ "<class 'test.test_class.ClassTests.test_class_repr.<locals>.A'"
+ " at 0x.+>")
+
if __name__ == '__main__':
unittest.main()