mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
With some changes of my own thrown in (e.g. backport of r58107).
This commit is contained in:
parent
cc7f26bf20
commit
64c06e327d
13 changed files with 822 additions and 51 deletions
|
@ -557,6 +557,8 @@ class TestHashMappingProtocol(TestMappingProtocol):
|
|||
class BadEq(object):
|
||||
def __eq__(self, other):
|
||||
raise Exc()
|
||||
def __hash__(self):
|
||||
return 24
|
||||
|
||||
d = self._empty_mapping()
|
||||
d[BadEq()] = 42
|
||||
|
@ -642,6 +644,8 @@ class TestHashMappingProtocol(TestMappingProtocol):
|
|||
class BadCmp(object):
|
||||
def __eq__(self, other):
|
||||
raise Exc()
|
||||
def __hash__(self):
|
||||
return 42
|
||||
|
||||
d1 = self._full_mapping({BadCmp(): 1})
|
||||
d2 = self._full_mapping({1: 1})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue