Adding a test for generator support (#171)

* Add a test for generators

* Remove output annotations from decorators

Also guarded torch imports for better compatibility with
requirements.txt

* Add flag to the main meta class to skip the typecheck

* Return to the old solution

* Make async tests work

* Minor adjustments/fixing typos

* Correct Python path for new tests

* Remove some jax-dependent code

* Implement equality for MetaArrays

* Make all Dim variations frozen dataclasses

* Shorten AbstractArray methods

* Final touches

* Removing get_origin use

* Update tests with @jaxtyp
This commit is contained in:
Roman Knyazhitskiy
2024-02-25 12:07:01 +00:00
committed by Patrick Kidger
parent 17ea4b13eb
commit 172b83b4fc
8 changed files with 246 additions and 43 deletions
+7 -2
View File
@@ -1,9 +1,14 @@
import subprocess
import sys
_py_path = sys.executable
def test_no_jax_dependency():
result = subprocess.run(
"python -c 'import jaxtyping; import sys; sys.exit(\"jax\" in sys.modules)'",
f"{_py_path} -c "
"'import jaxtyping; import sys; sys.exit(\"jax\" in sys.modules)'",
shell=True,
)
assert result.returncode == 0
@@ -13,7 +18,7 @@ def test_no_jax_dependency():
# subprocess.)
def test_meta():
result = subprocess.run(
"python -c 'import jaxtyping; import jax; import sys; "
f"{_py_path} -c 'import jaxtyping; import jax; import sys; "
'sys.exit("jax" in sys.modules)\'',
shell=True,
)