diff options
author | Raymond Hettinger <python@rcn.com> | 2011-04-15 20:12:21 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-04-15 20:12:21 (GMT) |
commit | 37c0fe56b9053f5f388ba6d6217506a6e73bb819 (patch) | |
tree | 6bfb62f27d7eea8b75d21a8380f25a46376353bd /Lib/test/test_collections.py | |
parent | 65c620d0c771e69a7177fc845273000e97dcf472 (diff) | |
download | cpython-37c0fe56b9053f5f388ba6d6217506a6e73bb819.zip cpython-37c0fe56b9053f5f388ba6d6217506a6e73bb819.tar.gz cpython-37c0fe56b9053f5f388ba6d6217506a6e73bb819.tar.bz2 |
Fix minor subclassing issue with collections.Counter
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index f6a43fc..8bdeb3d 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -689,6 +689,15 @@ class TestCounter(unittest.TestCase): self.assertEqual(len(dup), len(words)) self.assertEqual(type(dup), type(words)) + def test_copy_subclass(self): + class MyCounter(Counter): + pass + c = MyCounter('slartibartfast') + d = c.copy() + self.assertEqual(d, c) + self.assertEqual(len(d), len(c)) + self.assertEqual(type(d), type(c)) + def test_conversions(self): # Convert to: set, list, dict s = 'she sells sea shells by the sea shore' |