Skip to content

Commit dc2d4b9

Browse files
committed
Hack to allow top-level xps.complex_dtypes() for 2012.12
1 parent 6998b01 commit dc2d4b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

array_api_tests/test_fft.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import math
22
from typing import List, Optional
3+
from unittest.mock import MagicMock
34

45
import pytest
56
from hypothesis import assume, given
67
from hypothesis import strategies as st
78

89
from array_api_tests.typing import Array, DataType
910

11+
from . import api_version
1012
from . import dtype_helpers as dh
1113
from . import hypothesis_helpers as hh
1214
from . import pytest_helpers as ph
@@ -21,6 +23,11 @@
2123
]
2224

2325

26+
# Using xps.complex_dtypes() raises an AttributeError for 2021.12 instances of
27+
# xps, hence this hack. TODO: figure out a better way to manage this!
28+
if api_version < "2022.12":
29+
xps = MagicMock(xps)
30+
2431
fft_shapes_strat = hh.shapes(min_dims=1).filter(lambda s: math.prod(s) > 1)
2532

2633

0 commit comments

Comments
 (0)