Add types for assertpy for mypy or pyright.
$ pip install assertpy-stubs
Mypy or pyright will automatically use the type annotations in this package, once it is installed. You just need to annotate your code:
from assertpy import assert_that
def test_something():
assert_that(1 + 2).is_equal_to(3)
assert_that("foobar").is_length(6).starts_with("foo").ends_with("bar")
assert_that(["a", "b", "c"]).contains("a").does_not_contain("x")
For general hints how to use type annotations, please read Type Annotations in Python 3.8