diff options
author | Raymond Hettinger <python@rcn.com> | 2011-04-15 20:16:46 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-04-15 20:16:46 (GMT) |
commit | 1c746c28f3cfe798ed4d7b51f50adaa685a4fb0e (patch) | |
tree | 3d49b1db826c930f49a4a3f1fbf1a52d54a91890 /Lib/test/test_collections.py | |
parent | 181810b5febf8f5a66a93158500e302f7fff4d1e (diff) | |
download | cpython-1c746c28f3cfe798ed4d7b51f50adaa685a4fb0e.zip cpython-1c746c28f3cfe798ed4d7b51f50adaa685a4fb0e.tar.gz cpython-1c746c28f3cfe798ed4d7b51f50adaa685a4fb0e.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 8989ac3..3d6ad09 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -680,6 +680,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' |