Код: Выделить всё
def test_transaction(self, the_client):
[...]
transaction: Transaction = transactions.filter([...]).first()
# NOTE: this is stupid and unnecessary just to satisfy mypy.
# the next expect() will bail if this test is true,
# so this if statement is completely superfluous
if transaction is None:
raise AssertionError("missing transaction")
# I want to tell mypy this works like the above if statement
expect(transaction).not_to(be_none())
# if the if statement above isn't there, it tells me
# None | Transaction doesn't have the property "client"
expect(transaction.client).to(equal(the_client))
[...]
У меня есть django и установлены заглушки drf.
Подробнее здесь: https://stackoverflow.com/questions/790 ... ytest-test