Skip to content

Commit

Permalink
beartype.door API tests x 8.
Browse files Browse the repository at this point in the history
This commit by Harvard microscopist and general genius @tlambert03 is
the next in a commit chain repairing currently failing tests pertaining
to the `beartype.door` subpackage, recently implemented by... yup, it's
@tlambert03 strikes again in PR #136. Specifically, this commit improves
coverage by extending unit tests for this subpackage to additionally
test PEP 484- and 585-compliant `{collections.abc,typing}.Type[...]`
type hints against the `beartype.door.TypeHint` API. (*Long-lasting bold holdfast!*)
  • Loading branch information
tlambert03 committed Jul 19, 2022
1 parent c05ab19 commit ea811dd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions beartype_test/a00_unit/a60_api/door/test_door.py
Expand Up @@ -77,6 +77,7 @@ def hint_subhint_cases() -> 'Iterable[Tuple[object, object, bool]]':
Sequence,
Sized,
Tuple,
Type,
NamedTuple,
Union,
)
Expand All @@ -86,6 +87,8 @@ class MuhThing:
def muh_method(self):
...

class MuhSubThing(MuhThing):
...

class MuhNutherThing:
def __len__(self) -> int:
Expand Down Expand Up @@ -140,6 +143,12 @@ class MuhTuple(NamedTuple):
(List[int], List[Any], True),
(Awaitable, Awaitable[str], False),
(List[int], List[str], False),
# types
(Type[int], Type[int], True),
(Type[int], Type[str], False),
(Type[MuhSubThing], Type[MuhThing], True),
(Type[MuhThing], Type[MuhSubThing], False),
(MuhThing, Type[MuhThing], False),
# maps
(dict, Dict, True),
(Dict[str, int], Dict, True),
Expand Down

0 comments on commit ea811dd

Please sign in to comment.