The import hook now decorates dataclass __init__ methods (#48)

This commit is contained in:
Patrick Kidger
2022-11-16 13:38:04 -08:00
committed by GitHub
parent 784aa78f7c
commit a220df9964
8 changed files with 110 additions and 29 deletions
+7 -11
View File
@@ -26,9 +26,8 @@ def test_import_hook_typeguard():
hook = install_import_hook(
"test.import_hook_tester_typeguard", ("typeguard", "typechecked")
)
from . import import_hook_tester_typeguard # noqa: F401
hook.uninstall()
with hook:
from . import import_hook_tester_typeguard # noqa: F401
def test_import_hook_beartype():
@@ -40,24 +39,21 @@ def test_import_hook_beartype():
hook = install_import_hook(
"test.import_hook_tester_beartype", ("beartype", "beartype")
)
from . import import_hook_tester_beartype # noqa: F401
hook.uninstall()
with hook:
from . import import_hook_tester_beartype # noqa: F401
def test_import_hook_transitive():
hook = install_import_hook(
"test.import_hook_tester_transitive", ("typeguard", "typechecked")
)
from . import import_hook_tester_transitive # noqa: F401
hook.uninstall()
with hook:
from . import import_hook_tester_transitive # noqa: F401
def test_import_hook_broken_checker():
hook = install_import_hook(
"test.import_hook_tester_broken_checker", ("jaxtyping", "does_not_exist")
)
with pytest.raises(AttributeError):
with hook, pytest.raises(AttributeError):
from . import import_hook_tester_broken_checker # noqa: F401
hook.uninstall()