Skip to content

Commit

Permalink
Move Array API tests up and rename and address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagoel4512 committed Jan 31, 2025
1 parent 5f91aed commit cfa45d7
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "array-api-tests"]
path = api-coverage-tests
url = git@github.com:adityagoel4512/array-api-tests.git
branch = skip-unused-kinds-in-default
[submodule "api-coverage-tests"]
path = array-api-tests
url = git@github.com:data-apis/array-api-tests.git
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
language: system
types: [python]
require_serial: true
exclude: ^(tests|api-coverage-tests)/
exclude: ^(tests|array-api-tests)/
# prettier
- id: prettier
name: prettier
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pytest tests -n auto

It has a couple of key features:

- It implements the [`Array API`](https://data-apis.org/array-api/) standard. Standard compliant code can be executed without changes across numerous backends such as like `NumPy`, `JAX` and now `ndonnx`.
- It implements the [`Array API`](https://data-apis.org/array-api/) standard. Standard compliant code can be executed without changes across numerous backends such as like NumPy, JAX and now ndonnx.

```python
import numpy as np
Expand Down Expand Up @@ -93,7 +93,7 @@ In the future we will be enabling a stable API for an extensible data type syste

## Array API coverage

Array API compatibility is tracked in `api-coverage-tests`. Missing coverage is tracked in the `skips.txt` file. Contributions are welcome!
Array API compatibility is tracked in `array-api-tests`. Missing coverage is tracked in the `skips.txt` file. Contributions are welcome!

Summary(1119 total):

Expand Down
1 change: 0 additions & 1 deletion api-coverage-tests
Submodule api-coverage-tests deleted from aec51e
1 change: 1 addition & 0 deletions array-api-tests
Submodule array-api-tests added at dad773
2 changes: 1 addition & 1 deletion ndonnx/_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def device(self):
def to_device(
self, device: _Device, /, *, stream: int | Any | None = None
) -> Array:
if device is not device:
if device != self.device:
raise ValueError("Cannot move Array to a different device")
if stream is not None:
raise ValueError("The 'stream' parameter is not supported in ndonnx.")
Expand Down
8 changes: 4 additions & 4 deletions ndonnx/_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import annotations

import ndonnx as ndx
from ndonnx._array import device
from ndonnx._array import _Device, device
from ndonnx._data_types import canonical_name


Expand All @@ -25,16 +25,16 @@ class ArrayNamespaceInfo:
ndx.uint64,
]

def capabilities(self) -> dict:
def capabilities(self) -> dict[str, bool]:
return {
"boolean indexing": True,
"data-dependent shapes": True,
}

def default_device(self):
def default_device(self) -> _Device:
return device

def devices(self) -> list:
def devices(self) -> list[_Device]:
return [device]

def dtypes(
Expand Down
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test = "pytest"
test-coverage = "pytest --cov=ndonnx --cov-report=xml --cov-report=term-missing"

[feature.test.tasks.arrayapitests]
cmd = "pytest api-coverage-tests/array_api_tests/ -v -rfX --json-report --json-report-file=api-coverage-tests.json -n auto --disable-deadline --disable-extension linalg --skips-file=skips.txt --xfails-file=xfails.txt"
cmd = "pytest array_api_tests/ -v -rfX --json-report --json-report-file=api-coverage-tests.json -n auto --disable-deadline --disable-extension linalg --skips-file=skips.txt --xfails-file=xfails.txt"
[feature.test.tasks.arrayapitests.env]
ARRAY_API_TESTS_MODULE = "ndonnx"
ARRAY_API_TESTS_VERSION = "2023.12"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ indent-style = "space"
python_version = '3.10'
no_implicit_optional = true
check_untyped_defs = true
exclude = ["api-coverage-tests", "tests"]
exclude = ["array-api-tests", "tests"]

[[tool.mypy.overrides]]
module = ["onnxruntime"]
ignore_missing_imports = true

[tool.pytest.ini_options]
addopts = "--ignore=api-coverage-tests"
addopts = "--ignore=array-api-tests"
filterwarnings = ["ignore:.*google.protobuf.pyext.*:DeprecationWarning"]

[tool.typos.default]
Expand Down

0 comments on commit cfa45d7

Please sign in to comment.