summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-12-10 08:20:31 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-12-10 08:20:31 (GMT)
commit1f79cdfbfa3f53fb1aa3bb8998c463a5d2614795 (patch)
treeb665294704eb90e7e2e9fd337b3c672fabfe037e /Lib
parent9df8a1c1126e5db933300495974c06dcb592528e (diff)
downloadcpython-1f79cdfbfa3f53fb1aa3bb8998c463a5d2614795.zip
cpython-1f79cdfbfa3f53fb1aa3bb8998c463a5d2614795.tar.gz
cpython-1f79cdfbfa3f53fb1aa3bb8998c463a5d2614795.tar.bz2
Issue #19928: Implemented a test for repr() of cell objects.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_reprlib.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py
index 7bf2247..3687de9 100644
--- a/Lib/test/test_reprlib.py
+++ b/Lib/test/test_reprlib.py
@@ -166,10 +166,16 @@ class ReprTests(unittest.TestCase):
eq(r([[[[[[{}]]]]]]), "[[[[[[{}]]]]]]")
eq(r([[[[[[[{}]]]]]]]), "[[[[[[[...]]]]]]]")
- @unittest.skip('hard to catch a cell object')
def test_cell(self):
- # XXX Hmm? How to get at a cell object?
- pass
+ def get_cell():
+ x = 42
+ def inner():
+ return x
+ return inner
+ x = get_cell().__closure__[0]
+ self.assertRegex(repr(x),
+ r'<cell at 0x[0-9a-f]+: int object at 0x[0-9a-f]+>')
+ self.assertRegex(r(x), r'<cell at 0x.*\.\.\..*>')
def test_descriptors(self):
eq = self.assertEqual