-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
Hi, thanks so much for this awesome library! I'm using python 3.10.15, with PyHamcrest 2.1.0 and mypy 1.15.0.
I've tried the following:
from hamcrest import has_entry, has_item
has_item(has_entry("name", "Sky"))and mypy complains:
error: Argument 1 to "has_item" has incompatible type "Matcher[Mapping[str, str]]"; expected "Matcher[Never]" [arg-type]
Am I doing something wrong? Is this an issue with mypy? Or is this an issue in PyHamcrest's typing? Or maybe I'm just using incompatible versions of the three?
Thanks for the help!
# More realistic example:
x = [{"name": "Tim", "age": 5},{"name": "Alice", "age": 2},{"name": "Sky", "age": 13},{"name": "Xin", "age": 22}]
assert_that(x, has_item(has_entry("name", "Alice")))
# Cannot infer type argument 1 of "assert_that" Mypy misc
# Argument 1 to "has_item" has incompatible type "Matcher[Mapping[str, str]]"; expected "Matcher[Never]" Mypy arg-typeafiolmahon
Metadata
Metadata
Assignees
Labels
No labels