Transitive test now uses typeguard instead of beartype

This commit is contained in:
Patrick Kidger
2023-04-19 11:48:08 -07:00
parent c92b0d0ab1
commit 46c7896c99
2 changed files with 11 additions and 10 deletions
@@ -17,7 +17,6 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import equinox as eqx
import jax.numpy as jnp
import pytest
@@ -35,13 +34,15 @@ with pytest.raises(ParamError):
g(jnp.array(1))
class M(eqx.Module):
foo: int
bar: Float32[jnp.ndarray, " a"]
# Typeguard 3.0 no longer supports this
#
# class M(eqx.Module):
# foo: int
# bar: Float32[jnp.ndarray, " a"]
M(1, jnp.array([1.0]))
with pytest.raises(ParamError):
M(1.0, jnp.array([1.0]))
with pytest.raises(ParamError):
M(1, jnp.array(1.0))
# M(1, jnp.array([1.0]))
# with pytest.raises(ParamError):
# M(1.0, jnp.array([1.0]))
# with pytest.raises(ParamError):
# M(1, jnp.array(1.0))
+1 -1
View File
@@ -78,7 +78,7 @@ def test_import_hook_beartype_full():
def test_import_hook_transitive():
hook = install_import_hook(
"test.import_hook_tester_transitive", "beartype.beartype"
"test.import_hook_tester_transitive", "typeguard.typechecked"
)
with hook:
from . import import_hook_tester_transitive # noqa: F401