diff options
author | Raymond Hettinger <python@rcn.com> | 2008-06-23 03:29:28 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-06-23 03:29:28 (GMT) |
commit | 4c52f52ef3051af3b3504b7a0818e5948daa03a7 (patch) | |
tree | b359906dbf08dac123714bbd8140987123ff4f0d /Lib | |
parent | 9da18b313342ec6d81bd5ea5d19c1d05f6a41a08 (diff) | |
download | cpython-4c52f52ef3051af3b3504b7a0818e5948daa03a7.zip cpython-4c52f52ef3051af3b3504b7a0818e5948daa03a7.tar.gz cpython-4c52f52ef3051af3b3504b7a0818e5948daa03a7.tar.bz2 |
Issue 3161: Missing import and test.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/_abcoll.py | 1 | ||||
-rw-r--r-- | Lib/test/test_collections.py | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index 5acbb70..85d733f 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -9,6 +9,7 @@ bootstrapping issues. Unit tests are in test_collections. """ from abc import ABCMeta, abstractmethod +import sys __all__ = ["Hashable", "Iterable", "Iterator", "Sized", "Container", "Callable", diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 4f823e3..99eb8cf 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -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)) |