typing.py: merge 3.5->3.6 (Tuple/ellipsis/equality).
This commit is contained in:
commit
49ed08fd0b
|
@ -359,6 +359,12 @@ class TupleTests(TestCase):
|
|||
self.assertTrue(issubclass(tuple, Tuple))
|
||||
self.assertFalse(issubclass(Tuple, tuple)) # Can't have it both ways.
|
||||
|
||||
def test_equality(self):
|
||||
assert Tuple[int] == Tuple[int]
|
||||
assert Tuple[int, ...] == Tuple[int, ...]
|
||||
assert Tuple[int] != Tuple[int, int]
|
||||
assert Tuple[int] != Tuple[int, ...]
|
||||
|
||||
def test_tuple_subclass(self):
|
||||
class MyTuple(tuple):
|
||||
pass
|
||||
|
|
|
@ -705,7 +705,8 @@ class TupleMeta(TypingMeta):
|
|||
def __eq__(self, other):
|
||||
if not isinstance(other, TupleMeta):
|
||||
return NotImplemented
|
||||
return self.__tuple_params__ == other.__tuple_params__
|
||||
return (self.__tuple_params__ == other.__tuple_params__ and
|
||||
self.__tuple_use_ellipsis__ == other.__tuple_use_ellipsis__)
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.__tuple_params__)
|
||||
|
|
Loading…
Reference in New Issue