Skip to content

Commit 693c29b

Browse files
authored
Merge pull request #83 from honno/ci-clearup
CI clearup
2 parents 91026c0 + 4d1b333 commit 693c29b

7 files changed

+215
-178
lines changed

.github/workflows/generate_stubs.yml

-34
This file was deleted.

.github/workflows/numpy.yml

+11-19
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install dependencies
2020
run: |
2121
python -m pip install --upgrade pip
22-
python -m pip install git+https://github.com/numpy/numpy
22+
python -m pip install numpy==1.22.1
2323
python -m pip install -r requirements.txt
2424
- name: Run the test suite
2525
env:
@@ -28,26 +28,18 @@ jobs:
2828
# Mark some known issues as XFAIL
2929
cat << EOF >> xfails.txt
3030
31+
# copy not implemented
32+
array_api_tests/test_creation_functions.py::test_asarray_arrays
3133
# https://github.com/numpy/numpy/issues/18881
3234
array_api_tests/test_creation_functions.py::test_linspace
33-
# einsum is not yet completed in the spec
34-
array_api_tests/test_signatures.py::test_has_names[einsum]
35-
# dlpack support is not yet implemented in NumPy
36-
# See https://github.com/numpy/numpy/pull/19083
37-
array_api_tests/test_signatures.py::test_function_positional_args[__dlpack__]
38-
array_api_tests/test_signatures.py::test_function_positional_args[__dlpack_device__]
39-
array_api_tests/test_signatures.py::test_function_positional_args[from_dlpack]
40-
array_api_tests/test_signatures.py::test_function_positional_args[to_device]
41-
array_api_tests/test_signatures.py::test_function_keyword_only_args[__dlpack__]
42-
# floor_divide has an issue related to https://github.com/data-apis/array-api/issues/264
43-
array_api_tests/test_elementwise_functions.py::test_floor_divide
44-
# mesgrid doesn't return all arrays as the promoted dtype
45-
array_api_tests/test_type_promotion.py::test_meshgrid
46-
# https://github.com/numpy/numpy/pull/20066#issuecomment-947056094
47-
array_api_tests/test_type_promotion.py::test_where
48-
# shape mismatches are not handled
49-
array_api_tests/test_type_promotion.py::test_tensordot
35+
# https://github.com/numpy/numpy/issues/20870
36+
array_api_tests/test_data_type_functions.py::test_can_cast
37+
# linalg tests generally need more mulling over
38+
array_api_tests/test_linalg.py
39+
# waiting on NumPy to allow/revert distinct NaNs for np.unique
40+
# https://github.com/numpy/numpy/issues/20326#issuecomment-1012380448
41+
array_api_tests/test_set_functions.py
5042
5143
EOF
5244
53-
pytest -v -rxXfE
45+
pytest -v -rxXfE --ci

array_api_tests/dtype_helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def result_type(*dtypes: DataType):
216216
"ceil": numeric_dtypes,
217217
"cos": float_dtypes,
218218
"cosh": float_dtypes,
219-
"divide": numeric_dtypes,
219+
"divide": float_dtypes,
220220
"equal": all_dtypes,
221221
"exp": float_dtypes,
222222
"expm1": float_dtypes,

array_api_tests/test_array_object.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_setitem_masking(shape, data):
167167
scalar_type = dh.get_scalar_type(x.dtype)
168168
for idx in sh.ndindex(x.shape):
169169
if key[idx]:
170-
if isinstance(value, Scalar):
170+
if isinstance(value, get_args(Scalar)):
171171
ph.assert_scalar_equals(
172172
"__setitem__",
173173
scalar_type,
@@ -200,7 +200,7 @@ def make_param(method_name: str, dtype: DataType, stype: ScalarType) -> Param:
200200
+ [make_param("__float__", d, float) for d in dh.float_dtypes],
201201
)
202202
@given(data=st.data())
203-
def test_duck_typing(method_name, dtype, stype, data):
203+
def test_scalar_casting(method_name, dtype, stype, data):
204204
x = data.draw(xps.arrays(dtype, shape=()), label="x")
205205
method = getattr(x, method_name)
206206
out = method()

array_api_tests/test_creation_functions.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -479,27 +479,26 @@ def test_linspace(num, dtype, endpoint, data):
479479
ah.assert_exactly_equal(out, expected)
480480

481481

482-
@given(
482+
@given(dtype=xps.numeric_dtypes(), data=st.data())
483+
def test_meshgrid(dtype, data):
483484
# The number and size of generated arrays is arbitrarily limited to prevent
484485
# meshgrid() running out of memory.
485-
dtypes=hh.mutually_promotable_dtypes(5, dtypes=dh.numeric_dtypes),
486-
data=st.data(),
487-
)
488-
def test_meshgrid(dtypes, data):
489-
arrays = []
490486
shapes = data.draw(
491-
hh.mutually_broadcastable_shapes(
492-
len(dtypes), min_dims=1, max_dims=1, max_side=5
487+
st.integers(1, 5).flatmap(
488+
lambda n: hh.mutually_broadcastable_shapes(
489+
n, min_dims=1, max_dims=1, max_side=5
490+
)
493491
),
494492
label="shapes",
495493
)
496-
for i, (dtype, shape) in enumerate(zip(dtypes, shapes), 1):
494+
arrays = []
495+
for i, shape in enumerate(shapes, 1):
497496
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f"x{i}")
498497
arrays.append(x)
499498
assert math.prod(x.size for x in arrays) <= hh.MAX_ARRAY_SIZE # sanity check
500499
out = xp.meshgrid(*arrays)
501500
for i, x in enumerate(out):
502-
ph.assert_dtype("meshgrid", dtypes, x.dtype, repr_name=f"out[{i}].dtype")
501+
ph.assert_dtype("meshgrid", dtype, x.dtype, repr_name=f"out[{i}].dtype")
503502

504503

505504
def make_one(dtype: DataType) -> Scalar:

0 commit comments

Comments
 (0)