Skip to content

runtype does not respect transitivity of subtyping relation between MutableMapping and Mapping #74

Description

@27359794
(Pdb) runtype.issubclass(typing.MutableMapping[str, int], typing.Mapping[str, int])
True
(Pdb) runtype.issubclass(typing.Mapping[str, int], typing.Mapping[str, int | str])
True
(Pdb) runtype.issubclass(typing.MutableMapping[str, int], typing.Mapping[str, int | str])
False

By transitivity of subtype relation, if the first two expressions hold, then the third must hold as well. But according to the library, the third expression is False.

Environment: Python 3.12, runtype version 0.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions