mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37685: Use singletons ALWAYS_EQ and NEVER_EQ in more tests. (GH-15167)
This commit is contained in:
parent
662db125cd
commit
7d44e7a456
9 changed files with 30 additions and 57 deletions
|
@ -1,5 +1,6 @@
|
|||
from collections import deque
|
||||
import unittest
|
||||
from test.support import NEVER_EQ
|
||||
|
||||
|
||||
class base_set:
|
||||
|
@ -69,13 +70,7 @@ class TestContains(unittest.TestCase):
|
|||
# containment and equality tests involving elements that are
|
||||
# not necessarily equal to themselves
|
||||
|
||||
class MyNonReflexive(object):
|
||||
def __eq__(self, other):
|
||||
return False
|
||||
def __hash__(self):
|
||||
return 28
|
||||
|
||||
values = float('nan'), 1, None, 'abc', MyNonReflexive()
|
||||
values = float('nan'), 1, None, 'abc', NEVER_EQ
|
||||
constructors = list, tuple, dict.fromkeys, set, frozenset, deque
|
||||
for constructor in constructors:
|
||||
container = constructor(values)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue