Skip to content

Commit

Permalink
Handle type validation for string type hints
Browse files Browse the repository at this point in the history
With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_type_hints to evaluate the type hints at runtime

Handle type validation for string type hints

With `from __future__ import annotations`, all type hints become strings. The current type validator assumes that what is being checked is a type and not a string, so no types are being validated in these cases.

The fix is to use Python's typing.get_ty…
  • Loading branch information
williamlw999-fb committed Jul 6, 2022
1 parent 97277f4 commit 1f598d2
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
67 changes: 67 additions & 0 deletions tests/mock_callable_testslide.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,36 @@ def passes_with_invalid_argument_type(self):
}
self.callable_target(*call_args, **call_kwargs)

@context.example
def passes_with_valid_str_types(self):
args = (
"str val",
1234,
{"key1": "string", "key2": 4321},
)
kwargs = {"kwarg1": 1234}
self.mock_callable(
sample_module, "instance_method_with_str_types"
).for_call(*args, **kwargs).to_return_value("hello")
sample_module.instance_method_with_str_types(
*args, **kwargs
)

@context.example
def raises_TypeCheckError_for_invalid_str_types(self):
args = (1234, 1234, 1234)
kwargs = {"kwarg1": "str val"}
self.mock_callable(
sample_module, "instance_method_with_str_types"
).for_call(*args, **kwargs).to_return_value("hello")
with self.assertRaisesRegex(
TypeCheckError,
r"(?ms)type of arg1 must be str.*type of arg3 must be a dict.*",
):
sample_module.instance_method_with_str_types(
*args, **kwargs
)

if has_return_value:

@context.sub_context
Expand All @@ -206,6 +236,43 @@ def raises_TypeCheckError(self):
*self.call_args, **self.call_kwargs
)

@context.example
def passes_with_valid_str_return_types(self):
args = (
"str val",
1234,
{"key1": "string", "key2": 4321},
)
kwargs = {"kwarg1": 1234}
self.mock_callable(
sample_module, "instance_method_with_str_types"
).to_return_value("hello")
sample_module.instance_method_with_str_types(
*args, **kwargs
)

@context.example
def raises_TypeCheckError_for_invalid_str_return_types(
self,
):
args = (
"str val",
1234,
{"key1": "string", "key2": 4321},
)
kwargs = {"kwarg1": 1234}
self.mock_callable(
sample_module, "instance_method_with_str_types"
).to_return_value(1234)
with self.assertRaisesRegex(
TypeCheckError,
r"(?ms)type of return must be one of \(str, NoneType\); "
"got int instead: 1234.*",
):
sample_module.instance_method_with_str_types(
*args, **kwargs
)

@context.sub_context(".for_call(*args, **kwargs)")
def for_call_args_kwargs(context):
@context.sub_context
Expand Down
6 changes: 6 additions & 0 deletions tests/sample_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ def test_function_returns_coroutine(
return async_test_function(arg1, arg2, kwarg1, kwarg2)


def instance_method_with_str_types(
arg1: "str", arg2: "Any", arg3: "UnionArgType", kwarg1: "int"
) -> "Optional[str]":
return "original response"


UnionArgType = Dict[str, Union[str, int]]


Expand Down
21 changes: 16 additions & 5 deletions testslide/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
from functools import wraps
from inspect import Traceback
from types import FrameType
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type, Union
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Optional,
Tuple,
Type,
Union,
get_type_hints,
)
from unittest.mock import Mock

import typeguard
Expand Down Expand Up @@ -245,6 +255,7 @@ def _validate_callable_arg_types(
kwargs: Dict[str, Any],
) -> None:
argspec = inspect.getfullargspec(callable_template)
type_hints = get_type_hints(callable_template)
idx_offset = 1 if skip_first_arg else 0
type_errors = []
for idx in range(0, len(args)):
Expand All @@ -255,7 +266,7 @@ def _validate_callable_arg_types(
raise TypeError("Extra argument given: ", repr(args[idx]))
argname = argspec.args[idx + idx_offset]
try:
expected_type = argspec.annotations.get(argname)
expected_type = type_hints.get(argname)
if not expected_type:
continue

Expand All @@ -265,7 +276,7 @@ def _validate_callable_arg_types(

for argname, value in kwargs.items():
try:
expected_type = argspec.annotations.get(argname)
expected_type = type_hints.get(argname)
if not expected_type:
continue

Expand Down Expand Up @@ -359,10 +370,10 @@ def _validate_return_type(
unwrap_template_awaitable: bool = False,
) -> None:
try:
argspec = inspect.getfullargspec(template)
type_hints = get_type_hints(template)
expected_type = type_hints.get("return")
except TypeError:
return
expected_type = argspec.annotations.get("return")
if expected_type:
if unwrap_template_awaitable:
type_origin = get_origin(expected_type)
Expand Down

0 comments on commit 1f598d2

Please sign in to comment.