mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Issue 3161: Missing import and test.
This commit is contained in:
parent
9da18b3133
commit
4c52f52ef3
2 changed files with 16 additions and 0 deletions
|
@ -294,6 +294,21 @@ class TestCollectionABCs(unittest.TestCase):
|
|||
self.failUnless(isinstance(sample(), Set))
|
||||
self.failUnless(issubclass(sample, Set))
|
||||
|
||||
def test_hash_Set(self):
|
||||
class OneTwoThreeSet(Set):
|
||||
def __init__(self):
|
||||
self.contents = [1, 2, 3]
|
||||
def __contains__(self, x):
|
||||
return x in self.contents
|
||||
def __len__(self):
|
||||
return len(self.contents)
|
||||
def __iter__(self):
|
||||
return iter(self.contents)
|
||||
def __hash__(self):
|
||||
return self._hash()
|
||||
a, b = OneTwoThreeSet(), OneTwoThreeSet()
|
||||
self.failUnless(hash(a) == hash(b))
|
||||
|
||||
def test_MutableSet(self):
|
||||
self.failUnless(isinstance(set(), MutableSet))
|
||||
self.failUnless(issubclass(set, MutableSet))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue