Various fixups (most suggested by Armin Rigo).
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 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 @@
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 @@
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 @@
from test import test_sets
test_classes = (
TestSet,
+ TestSetSubclass,
TestFrozenSet,
+ TestFrozenSetSubclass,
TestSetOfSets,
TestExceptionPropagation,
TestBasicOpsEmpty,