diff options
author | Raymond Hettinger <python@rcn.com> | 2003-11-17 16:42:33 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-11-17 16:42:33 (GMT) |
commit | 50a4bb325c29e7ac2e4727787cb5a40f995ea204 (patch) | |
tree | 240ba663fb4d87bd8b8d951cf97f08ddc74c2785 /Lib/test/test_set.py | |
parent | e2c277a69f86480ce950399a2e8a215a48ee60cd (diff) | |
download | cpython-50a4bb325c29e7ac2e4727787cb5a40f995ea204.zip cpython-50a4bb325c29e7ac2e4727787cb5a40f995ea204.tar.gz cpython-50a4bb325c29e7ac2e4727787cb5a40f995ea204.tar.bz2 |
Various fixups (most suggested by Armin Rigo).
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r-- | Lib/test/test_set.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 1edb2dd..8329fd1 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -152,6 +152,13 @@ class TestJointOps(unittest.TestCase): class TestSet(TestJointOps): thetype = set + def test_init(self): + s = set() + s.__init__(self.word) + self.assertEqual(s, set(self.word)) + s.__init__(self.otherword) + self.assertEqual(s, set(self.otherword)) + def test_hash(self): self.assertRaises(TypeError, hash, self.s) @@ -252,10 +259,20 @@ class TestSet(TestJointOps): else: self.assert_(c not in self.s) +class SetSubclass(set): + pass + +class TestSetSubclass(TestSet): + thetype = SetSubclass class TestFrozenSet(TestJointOps): thetype = frozenset + def test_init(self): + s = frozenset() + s.__init__(self.word) + self.assertEqual(s, frozenset()) + def test_hash(self): self.assertEqual(hash(frozenset('abcdeb')), hash(frozenset('ebecda'))) @@ -273,6 +290,12 @@ class TestFrozenSet(TestJointOps): f = frozenset('abcdcda') self.assertEqual(hash(f), hash(f)) +class FrozenSetSubclass(frozenset): + pass + +class TestFrozenSetSubclass(TestFrozenSet): + thetype = FrozenSetSubclass + # Tests taken from test_sets.py ============================================= empty_set = set() @@ -1137,7 +1160,9 @@ def test_main(verbose=None): from test import test_sets test_classes = ( TestSet, + TestSetSubclass, TestFrozenSet, + TestFrozenSetSubclass, TestSetOfSets, TestExceptionPropagation, TestBasicOpsEmpty, |