[Python-checkins] cpython (2.7): Issue #19928: Implemented a test for repr() of cell objects.
serhiy.storchaka
python-checkins at python.org
Tue Dec 10 09:26:00 CET 2013
http://hg.python.org/cpython/rev/d98c5806c33c
changeset: 87873:d98c5806c33c
branch: 2.7
parent: 87870:df9596ca838c
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Dec 10 10:20:11 2013 +0200
summary:
Issue #19928: Implemented a test for repr() of cell objects.
files:
Lib/test/test_repr.py | 11 +++++++++--
Misc/NEWS | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -179,8 +179,15 @@
self.assertTrue(repr(x).startswith('<read-only buffer for 0x'))
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.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):
eq = self.assertEqual
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,8 @@
Tests
-----
+- Issue #19928: Implemented a test for repr() of cell objects.
+
- Issue #19595: Re-enabled a long-disabled test in test_winsound.
- Issue #19588: Fixed tests in test_random that were silently skipped most
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list