mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Mapping key type is invariant.
This commit is contained in:
parent
f8cd6632f6
commit
79e434d9e5
2 changed files with 8 additions and 8 deletions
|
@ -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],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue