Commit 95d72192 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #19928: Implemented a test for repr() of cell objects.

parent 7057f3fa
...@@ -179,8 +179,15 @@ class ReprTests(unittest.TestCase): ...@@ -179,8 +179,15 @@ class ReprTests(unittest.TestCase):
self.assertTrue(repr(x).startswith('<read-only buffer for 0x')) self.assertTrue(repr(x).startswith('<read-only buffer for 0x'))
def test_cell(self): def test_cell(self):
# XXX Hmm? How to get at a cell object? def get_cell():
pass x = 42
def inner():
return x
return inner
x = get_cell().__closure__[0]
self.assertRegexpMatches(repr(x), r'<cell at 0x[0-9a-f]+: '
r'int object at 0x[0-9a-f]+>')
self.assertRegexpMatches(r(x), r'<cell at.*\.\.\..*>')
def test_descriptors(self): def test_descriptors(self):
eq = self.assertEqual eq = self.assertEqual
......
...@@ -77,6 +77,8 @@ IDLE ...@@ -77,6 +77,8 @@ IDLE
Tests Tests
----- -----
- Issue #19928: Implemented a test for repr() of cell objects.
- Issue #19595: Re-enabled a long-disabled test in test_winsound. - Issue #19595: Re-enabled a long-disabled test in test_winsound.
- Issue #19588: Fixed tests in test_random that were silently skipped most - Issue #19588: Fixed tests in test_random that were silently skipped most
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment