[Python-checkins] cpython (merge 3.3 -> default): Issue #19928: Implemented a test for repr() of cell objects.
serhiy.storchaka
python-checkins at python.org
Tue Dec 10 09:26:02 CET 2013
http://hg.python.org/cpython/rev/af9f3d737d4a
changeset: 87875:af9f3d737d4a
parent: 87872:1d68ea8148ce
parent: 87874:49eb895be796
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Dec 10 10:21:51 2013 +0200
summary:
Issue #19928: Implemented a test for repr() of cell objects.
files:
Lib/test/test_reprlib.py | 12 +++++++++---
Misc/NEWS | 2 ++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py
--- a/Lib/test/test_reprlib.py
+++ b/Lib/test/test_reprlib.py
@@ -166,10 +166,16 @@
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
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -136,6 +136,8 @@
Tests
-----
+- Issue #19928: Implemented a test for repr() of cell objects.
+
- Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and
test_statistics when python is run with -OO.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list