summaryrefslogtreecommitdiff
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-11-05 13:35:26 -0700
committerRaymond Hettinger <python@rcn.com>2011-11-05 13:35:26 -0700
commit165c178322159dc4a8814cb98e72790e29e2e82b (patch)
treecda4c5ea86fb0dca2a32eb05e1fe06dcd4f02847 /Lib/test/test_collections.py
parent064498161274759a3e4b8ef03b37e336cf1ebf6b (diff)
downloadcpython-165c178322159dc4a8814cb98e72790e29e2e82b.tar.gz
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 ccf93c51c1..8dc5559cae 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')