Make test/helpers.py a relative import

This commit is contained in:
Patrick Kidger
2022-07-12 10:03:19 +01:00
parent 81238e38e8
commit 9f75958b2d
8 changed files with 20 additions and 14 deletions
View File
+2 -1
View File
@@ -19,10 +19,11 @@
import jax.numpy as jnp
import pytest
from helpers import ParamError
from jaxtyping import f32
from .helpers import ParamError
def g(x: f32[" b"]):
pass
+2 -1
View File
@@ -19,10 +19,11 @@
import jax.numpy as jnp
import pytest
from helpers import ParamError
from jaxtyping import f32
from .helpers import ParamError
def g(x: f32[" b"]):
pass
@@ -19,10 +19,11 @@
import jax.numpy as jnp
import pytest
from helpers import ParamError
from jaxtyping import f32
from ..helpers import ParamError
def g(x: f32[" b"]):
pass
+2 -1
View File
@@ -19,10 +19,11 @@
import jax.numpy as jnp
import pytest
from helpers import ParamError
from jaxtyping import f32
from .helpers import ParamError
def g(x: f32[" b"]):
pass
+2 -1
View File
@@ -20,10 +20,11 @@
import jax.numpy as jnp
import jax.random as jr
import pytest
from helpers import ParamError, ReturnError
from jaxtyping import Array, f, f32, jaxtyped
from .helpers import ParamError, ReturnError
def test_basic(typecheck):
@jaxtyped
+8 -8
View File
@@ -24,9 +24,9 @@ from jaxtyping import install_import_hook
def test_import_hook_typeguard():
hook = install_import_hook(
"import_hook_tester_typeguard", ("typeguard", "typechecked")
"test.import_hook_tester_typeguard", ("typeguard", "typechecked")
)
import import_hook_tester_typeguard # noqa: F401
from . import import_hook_tester_typeguard # noqa: F401
hook.uninstall()
@@ -38,26 +38,26 @@ def test_import_hook_beartype():
pass
else:
hook = install_import_hook(
"import_hook_tester_beartype", ("beartype", "beartype")
"test.import_hook_tester_beartype", ("beartype", "beartype")
)
import import_hook_tester_beartype # noqa: F401
from . import import_hook_tester_beartype # noqa: F401
hook.uninstall()
def test_import_hook_transitive():
hook = install_import_hook(
"import_hook_tester_transitive", ("typeguard", "typechecked")
"test.import_hook_tester_transitive", ("typeguard", "typechecked")
)
import import_hook_tester_transitive # noqa: F401
from . import import_hook_tester_transitive # noqa: F401
hook.uninstall()
def test_import_hook_broken_checker():
hook = install_import_hook(
"import_hook_tester_broken_checker", ("jaxtyping", "does_not_exist")
"test.import_hook_tester_broken_checker", ("jaxtyping", "does_not_exist")
)
with pytest.raises(AttributeError):
import import_hook_tester_broken_checker # noqa: F401
from . import import_hook_tester_broken_checker # noqa: F401
hook.uninstall()
+2 -1
View File
@@ -24,10 +24,11 @@ import jax
import jax.numpy as jnp
import jax.random as jr
import pytest
from helpers import make_mlp, ParamError
from jaxtyping import f, jaxtyped, PyTree
from .helpers import make_mlp, ParamError
def test_direct(typecheck):
@typecheck