Skip to content

CI clearup #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/generate_stubs.yml

This file was deleted.

30 changes: 11 additions & 19 deletions .github/workflows/numpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install git+https://github.com/numpy/numpy
python -m pip install numpy==1.22.1
python -m pip install -r requirements.txt
- name: Run the test suite
env:
Expand All @@ -28,26 +28,18 @@ jobs:
# Mark some known issues as XFAIL
cat << EOF >> xfails.txt

# copy not implemented
array_api_tests/test_creation_functions.py::test_asarray_arrays
# https://github.com/numpy/numpy/issues/18881
array_api_tests/test_creation_functions.py::test_linspace
# einsum is not yet completed in the spec
array_api_tests/test_signatures.py::test_has_names[einsum]
# dlpack support is not yet implemented in NumPy
# See https://github.com/numpy/numpy/pull/19083
array_api_tests/test_signatures.py::test_function_positional_args[__dlpack__]
array_api_tests/test_signatures.py::test_function_positional_args[__dlpack_device__]
array_api_tests/test_signatures.py::test_function_positional_args[from_dlpack]
array_api_tests/test_signatures.py::test_function_positional_args[to_device]
array_api_tests/test_signatures.py::test_function_keyword_only_args[__dlpack__]
# floor_divide has an issue related to https://github.com/data-apis/array-api/issues/264
array_api_tests/test_elementwise_functions.py::test_floor_divide
# mesgrid doesn't return all arrays as the promoted dtype
array_api_tests/test_type_promotion.py::test_meshgrid
# https://github.com/numpy/numpy/pull/20066#issuecomment-947056094
array_api_tests/test_type_promotion.py::test_where
# shape mismatches are not handled
array_api_tests/test_type_promotion.py::test_tensordot
# https://github.com/numpy/numpy/issues/20870
array_api_tests/test_data_type_functions.py::test_can_cast
# linalg tests generally need more mulling over
array_api_tests/test_linalg.py
# waiting on NumPy to allow/revert distinct NaNs for np.unique
# https://github.com/numpy/numpy/issues/20326#issuecomment-1012380448
array_api_tests/test_set_functions.py

EOF

pytest -v -rxXfE
pytest -v -rxXfE --ci
2 changes: 1 addition & 1 deletion array_api_tests/dtype_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def result_type(*dtypes: DataType):
"ceil": numeric_dtypes,
"cos": float_dtypes,
"cosh": float_dtypes,
"divide": numeric_dtypes,
"divide": float_dtypes,
"equal": all_dtypes,
"exp": float_dtypes,
"expm1": float_dtypes,
Expand Down
4 changes: 2 additions & 2 deletions array_api_tests/test_array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_setitem_masking(shape, data):
scalar_type = dh.get_scalar_type(x.dtype)
for idx in sh.ndindex(x.shape):
if key[idx]:
if isinstance(value, Scalar):
if isinstance(value, get_args(Scalar)):
ph.assert_scalar_equals(
"__setitem__",
scalar_type,
Expand Down Expand Up @@ -200,7 +200,7 @@ def make_param(method_name: str, dtype: DataType, stype: ScalarType) -> Param:
+ [make_param("__float__", d, float) for d in dh.float_dtypes],
)
@given(data=st.data())
def test_duck_typing(method_name, dtype, stype, data):
def test_scalar_casting(method_name, dtype, stype, data):
x = data.draw(xps.arrays(dtype, shape=()), label="x")
method = getattr(x, method_name)
out = method()
Expand Down
19 changes: 9 additions & 10 deletions array_api_tests/test_creation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,27 +479,26 @@ def test_linspace(num, dtype, endpoint, data):
ah.assert_exactly_equal(out, expected)


@given(
@given(dtype=xps.numeric_dtypes(), data=st.data())
def test_meshgrid(dtype, data):
# The number and size of generated arrays is arbitrarily limited to prevent
# meshgrid() running out of memory.
dtypes=hh.mutually_promotable_dtypes(5, dtypes=dh.numeric_dtypes),
data=st.data(),
)
def test_meshgrid(dtypes, data):
arrays = []
shapes = data.draw(
hh.mutually_broadcastable_shapes(
len(dtypes), min_dims=1, max_dims=1, max_side=5
st.integers(1, 5).flatmap(
lambda n: hh.mutually_broadcastable_shapes(
n, min_dims=1, max_dims=1, max_side=5
)
),
label="shapes",
)
for i, (dtype, shape) in enumerate(zip(dtypes, shapes), 1):
arrays = []
for i, shape in enumerate(shapes, 1):
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f"x{i}")
arrays.append(x)
assert math.prod(x.size for x in arrays) <= hh.MAX_ARRAY_SIZE # sanity check
out = xp.meshgrid(*arrays)
for i, x in enumerate(out):
ph.assert_dtype("meshgrid", dtypes, x.dtype, repr_name=f"out[{i}].dtype")
ph.assert_dtype("meshgrid", dtype, x.dtype, repr_name=f"out[{i}].dtype")


def make_one(dtype: DataType) -> Scalar:
Expand Down
Loading