From: Serhiy Storchaka Date: Tue, 10 Dec 2013 08:20:31 +0000 (+0200) Subject: Issue #19928: Implemented a test for repr() of cell objects. X-Git-Tag: v3.4.0b2~268^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f79cdfbfa3f53fb1aa3bb8998c463a5d2614795;p=python Issue #19928: Implemented a test for repr() of cell objects. --- diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py index 7bf224735e..3687de98b6 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'') + self.assertRegex(r(x), r'') def test_descriptors(self): eq = self.assertEqual diff --git a/Misc/NEWS b/Misc/NEWS index 535c3af0be..9026e754cb 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -114,6 +114,8 @@ IDLE Tests ----- +- Issue #19928: Implemented a test for repr() of cell objects. + - Issue #19535: Fixed test_docxmlrpc when python is run with -OO. - Issue #19926: Removed unneeded test_main from test_abstract_numbers.