Skip to content

Commit

Permalink
ENH Test tools for jax.jit and dask
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Jan 21, 2025
1 parent 6ee70c0 commit 57e6cd0
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 28 deletions.
12 changes: 12 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,15 @@
setdiff1d
sinc
```

## Testing utilities

```{eval-rst}
.. currentmodule:: array_api_extra.testing
.. autosummary::
:nosignatures:
:toctree: generated
lazy_xp_function
patch_lazy_xp_functions
```
14 changes: 13 additions & 1 deletion pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ furo = ">=2023.08.17"
myst-parser = ">=0.13"
sphinx-copybutton = "*"
sphinx-autodoc-typehints = "*"
# Needed to import parsed modules with autodoc
pytest = "*"

[tool.pixi.feature.docs.tasks]
docs = { cmd = "sphinx-build . build/", cwd = "docs" }
Expand Down Expand Up @@ -180,8 +182,10 @@ markers = ["skip_xp_backend(library, *, reason=None): Skip test for a specific b

[tool.coverage]
run.source = ["array_api_extra"]
report.exclude_also = ['\.\.\.']

report.exclude_also = [
'\.\.\.',
'if TYPE_CHECKING:',
]

# mypy

Expand Down Expand Up @@ -221,6 +225,8 @@ reportMissingImports = false
reportMissingTypeStubs = false
# false positives for input validation
reportUnreachable = false
# ruff handles this
reportUnusedParameter = false

executionEnvironments = [
{ root = "tests", reportPrivateUsage = false },
Expand Down Expand Up @@ -282,7 +288,10 @@ messages_control.disable = [
"design", # ignore heavily opinionated design checks
"fixme", # allow FIXME comments
"line-too-long", # ruff handles this
"unused-argument", # ruff handles this
"missing-function-docstring", # numpydoc handles this
"import-error", # mypy handles this
"import-outside-toplevel", # optional dependencies
]


Expand Down
22 changes: 11 additions & 11 deletions src/array_api_extra/_lib/_at.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def __getitem__(self, idx: Index, /) -> at: # numpydoc ignore=PR01,RT01
def _update_common(
self,
at_op: _AtOp,
y: Array,
y: Array | object,
/,
copy: bool | None,
xp: ModuleType | None,
Expand Down Expand Up @@ -253,7 +253,7 @@ def _update_common(

def set(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -269,8 +269,8 @@ def set(
def _iop(
self,
at_op: _AtOp,
elwise_op: Callable[[Array, Array], Array],
y: Array,
elwise_op: Callable[[Array, Array | object], Array],
y: Array | object,
/,
copy: bool | None,
xp: ModuleType | None,
Expand All @@ -294,7 +294,7 @@ def _iop(

def add(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -308,7 +308,7 @@ def add(

def subtract(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -318,7 +318,7 @@ def subtract(

def multiply(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -328,7 +328,7 @@ def multiply(

def divide(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -338,7 +338,7 @@ def divide(

def power(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -348,7 +348,7 @@ def power(

def min(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand All @@ -361,7 +361,7 @@ def min(

def max(
self,
y: Array,
y: Array | object,
/,
copy: bool | None = None,
xp: ModuleType | None = None,
Expand Down
1 change: 1 addition & 0 deletions src/array_api_extra/_lib/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Testing utilities.
Note that this is private API; don't expect it to be stable.
See also ..testing for public testing utilities.
"""

import math
Expand Down
Loading

0 comments on commit 57e6cd0

Please sign in to comment.