Mapping key type is invariant.

This commit is contained in:
Guido van Rossum 2015-06-07 13:36:19 -07:00
parent f8cd6632f6
commit 79e434d9e5
2 changed files with 8 additions and 8 deletions

View file

@ -707,11 +707,11 @@ class VarianceTests(TestCase):
typing.Sequence[Manager])
def test_covariance_mapping(self):
# Ditto for Mapping (a generic class with two parameters).
# Ditto for Mapping (covariant in the value, invariant in the key).
assert issubclass(typing.Mapping[Employee, Manager],
typing.Mapping[Employee, Employee])
assert issubclass(typing.Mapping[Manager, Employee],
typing.Mapping[Employee, Employee])
assert not issubclass(typing.Mapping[Manager, Employee],
typing.Mapping[Employee, Employee])
assert not issubclass(typing.Mapping[Employee, Manager],
typing.Mapping[Manager, Manager])
assert not issubclass(typing.Mapping[Manager, Employee],