Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/hamcrest/core/core/is_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Type, TypeVar, Union, overload
from typing import Optional, Type, TypeVar, overload, Any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this probably doesn't pass an isort check

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird - I did run the linting through tox.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we might have lost isort at some point. Hmph.


from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.description import Description
Expand Down Expand Up @@ -46,12 +46,17 @@ def _wrap_value_or_type(x):


@overload
def is_(x: Type) -> Matcher[object]:
def is_(x: Type) -> Matcher[Any]:
...


@overload
def is_(x: Union[Matcher[T], T]) -> Matcher[T]:
def is_(x: Matcher[T]) -> Matcher[T]:
...


@overload
def is_(x: T) -> Matcher[T]:
...


Expand Down
2 changes: 1 addition & 1 deletion tests/type-hinting/test_test_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
main: |
from hamcrest.library.text.isequal_ignoring_case import equal_to_ignoring_case

reveal_type(equal_to_ignoring_case("")) # N: Revealed type is 'hamcrest.core.matcher.Matcher[builtins.str]'
reveal_type(equal_to_ignoring_case("")) # N: Revealed type is "hamcrest.core.matcher.Matcher[builtins.str]"