forked from hamcrest/PyHamcrest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: provide correct type bounds on sequence matchers
fixes hamcrest#207 `Matcher[object]` is too tight of a bound on the output type; what we're asserting is that a matcher for `Any` type is what `has_properties` will do
- Loading branch information
Showing
5 changed files
with
39 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
``has_properties`` now returns ``Matcher[Any]`` type, which addresses type checking errors when nested as a matcher. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
- case: valid_has_items_has_properties | ||
skip: platform.python_implementation() == "PyPy" | ||
main: | | ||
from dataclasses import dataclass | ||
from hamcrest import assert_that, has_items, has_properties | ||
@dataclass | ||
class Example: | ||
name: str | ||
items = [Example("dave"), Example("wave")] | ||
a = assert_that(items, has_items(has_properties(name="dave"))) | ||
- case: valid_has_item_has_properties | ||
skip: platform.python_implementation() == "PyPy" | ||
main: | | ||
from dataclasses import dataclass | ||
from hamcrest import assert_that, has_item, has_properties | ||
@dataclass | ||
class Example: | ||
name: str | ||
items = [Example("dave"), Example("wave")] | ||
matcher = has_item(has_properties(name="dave")) | ||
a = assert_that(items, matcher) |