Skip to content

Commit

Permalink
fix array_api import at test_spec_elementwise_functions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrechykha committed Aug 8, 2024
1 parent 2ed4032 commit 63fa3ee
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions tests/test_spec_elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@

has_complex_dtype = True

if np.lib.NumpyVersion(np.__version__) < "2.0.0b1":
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import array_api_strict as xp # type: ignore[import-not-found]

has_complex_dtype = np.dtype("complex128") in xp._dtypes._all_dtypes
else:
xp = np

# if np.lib.NumpyVersion(np.__version__) < "2.0.0b1":
# with warnings.catch_warnings():
# warnings.simplefilter("ignore")
# import array_api_strict as xp # type: ignore[import-not-found]

# has_complex_dtype = np.dtype("complex128") in xp._dtypes._all_dtypes
# else:
# xp = np
devices = ["cpu"]
try:
import numpy.array_api as xp

has_complex_dtype = np.dtype("complex128") in xp._dtypes._all_dtypes
except ModuleNotFoundError:
import numpy as xp # noqa: ICN001
try:
import cupy as cp

Expand Down

0 comments on commit 63fa3ee

Please sign in to comment.