summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-11-05 20:35:26 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-11-05 20:35:26 (GMT)
commit4e6bf41934de08f62b22b90cda2e331eb4641dea (patch)
tree6fd3f1a8069eccab24e1d38fe5e093f9056ffa4e /Lib/test/test_collections.py
parent0115fae8c21122cda699d2d9fbf51f755bb7b365 (diff)
downloadcpython-4e6bf41934de08f62b22b90cda2e331eb4641dea.zip
cpython-4e6bf41934de08f62b22b90cda2e331eb4641dea.tar.gz
cpython-4e6bf41934de08f62b22b90cda2e331eb4641dea.tar.bz2
Improve Counter.__repr__() to not fail with unorderable values
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r--Lib/test/test_collections.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index ccf93c5..8dc5559 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -893,6 +893,12 @@ class TestCounter(unittest.TestCase):
c.subtract('aaaabbcce')
self.assertEqual(c, Counter(a=-1, b=0, c=-1, d=1, e=-1))
+ def test_repr_nonsortable(self):
+ c = Counter(a=2, b=None)
+ r = repr(c)
+ self.assertIn("'a': 2", r)
+ self.assertIn("'b': None", r)
+
def test_helper_function(self):
# two paths, one for real dicts and one for other mappings
elems = list('abracadabra')