-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
Using pyright:
# uv run pyright --version
pyright 1.1.408I get the following typing errors:
# These are fine:
self.assertThat(["foo"], MatchesSetwise(Equals("foo")))
foo = ("foo",)
self.assertThat([foo], MatchesSetwise(Equals(foo)))
self.assertThat([foo], MatchesSetwise(Equals(("foo",))))
# But this does not type check:
self.assertThat([("foo",)], MatchesSetwise(Equals(("foo",))))The error is:
Argument of type "MatchesSetwise[tuple[Literal['foo']]]"
cannot be assigned to parameter "matcher" of type "Matcher[T@assertThat]" in function "assertThat"
"MatchesSetwise[tuple[Literal['foo']]]" is not assignable to "Matcher[list[tuple[str]]]"
Type parameter "T@Matcher" is invariant,
but "Iterable[tuple[Literal['foo']]]" is not the same as "list[tuple[str]]" (reportArgumentType)
With mypy no errors are reported, so this might be a bug in pyright.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels