-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
stubs: false positiveType checkers report false errorsType checkers report false errors
Description
The stubs for assertpy.add_extension and assertpy.remove_extension should read:
def add_extension(func: Callable[..., AssertionBuilder]) -> None: ...
def remove_extension(func: Callable[..., AssertionBuilder]) -> None: ...With the current definitions, the following (valid) code fails pyrefly check:
import assertpy
from assertpy import assert_that
def all (self, predicate):
for val in self.val:
predicate (val)
return self
assertpy.add_extension (all)
assert_that ([1, 2, 3, 4]).all (lambda x: assert_that (x).is_less_than (10))ERROR Argument `(self: Unknown, predicate: Unknown) -> Unknown` is not assignable to parameter `func` with type `(AssertionBuilder[Any]) -> AssertionBuilder[Any]` in function `assertpy.assertpy.add_extension` [bad-argument-type]
--> main.py:8:25
|
8 | assertpy.add_extension (all)
| ^^^
|
INFO 1 error
Metadata
Metadata
Assignees
Labels
stubs: false positiveType checkers report false errorsType checkers report false errors