Skip to content

Commit dbde5a9

Browse files
authored
ENH: testing: make assertion functions public (#753)
* ENH: testing: make assertion functions public * revisions * TST/CI: add run-deps tests
1 parent 908592f commit dbde5a9

21 files changed

Lines changed: 950 additions & 614 deletions

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
runs-on: ubuntu-latest
5858
- environment: tests-backends-py311
5959
runs-on: ubuntu-latest
60+
- environment: tests-run-deps
61+
runs-on: ubuntu-slim
6062

6163
environment:
6264
name: ci-checks
@@ -76,7 +78,7 @@ jobs:
7678

7779
- name: Test package
7880
# Save some time; also at the moment of writing coverage crashes on python 3.13t
79-
if: ${{ matrix.environment != 'tests-nogil' }}
81+
if: ${{ matrix.environment != 'tests-nogil' && matrix.environment != 'tests-run-deps' }}
8082
run: pixi run -e "${TASK_ENV}" tests-ci
8183
env:
8284
TASK_ENV: ${{ matrix.environment }}
@@ -85,6 +87,10 @@ jobs:
8587
if: ${{ matrix.environment == 'tests-nogil' }}
8688
run: pixi run -e tests-nogil tests --parallel-threads=4
8789

90+
- name: Run dependency tests
91+
if: ${{ matrix.environment == 'tests-run-deps' }}
92+
run: pixi run tests-run-deps-cov
93+
8894
- name: Upload coverage report
8995
if: ${{ matrix.environment != 'tests-nogil' }}
9096
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ name | escape | underline }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ fullname }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ name | escape | underline }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autofunction:: {{ fullname }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ fullname.split('.')[-2:] | join('.') | escape | underline }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autofunction:: {{ fullname }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# API Reference
1+
# Assorted functions
22

33
```{eval-rst}
44
.. currentmodule:: array_api_extra

docs/api-lazy.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Tools for lazy backends
22

3-
These additional functions are meant to be used to support compatibility with
4-
lazy backends, e.g. Dask or JAX:
3+
Additional functions with special behaviour for lazy backends,
4+
e.g. Dask or JAX:
55

66
```{eval-rst}
77
.. currentmodule:: array_api_extra
@@ -10,6 +10,17 @@ lazy backends, e.g. Dask or JAX:
1010
:toctree: generated
1111
1212
lazy_apply
13+
```
14+
15+
Testing utilities:
16+
17+
```{eval-rst}
18+
.. currentmodule:: array_api_extra
19+
.. autosummary::
20+
:nosignatures:
21+
:template: testing-function.rst
22+
:toctree: generated
23+
1324
testing.lazy_xp_function
1425
testing.patch_lazy_xp_functions
1526
```

docs/api-testing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Testing utilities (`xpx.testing`)
2+
3+
These testing utilities are intended to help transition from using
4+
{py:mod}`numpy.testing`.
5+
6+
```{eval-rst}
7+
.. currentmodule:: array_api_extra.testing
8+
.. autosummary::
9+
:nosignatures:
10+
:template: testing-function.rst
11+
:toctree: generated
12+
13+
assert_close
14+
assert_equal
15+
assert_less
16+
```
17+
18+
See also utilities specific to testing lazy backends in {doc}`api-lazy`.

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@
6666
("py:class", "_io.BytesIO"),
6767
]
6868

69+
templates_path = ["_templates"]
70+
6971
always_document_param_types = True

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
:maxdepth: 2
55
:hidden:
66
self
7-
api-reference.md
7+
api-assorted.md
8+
api-testing.md
89
api-lazy.md
910
contributing.md
1011
contributors.md

pixi.lock

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)