Skip to content

Commit

Permalink
Merge pull request #104 from honno/rst-spec
Browse files Browse the repository at this point in the history
Utilise RST conversion of spec, generate runtime special cases tests
  • Loading branch information
honno authored Mar 22, 2022
2 parents 41c338b + 6642522 commit 5f2551c
Show file tree
Hide file tree
Showing 48 changed files with 1,440 additions and 5,384 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/numpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
python-version: [3.8, 3.9]

steps:
- uses: actions/checkout@v1
- name: Checkout array-api-tests
uses: actions/checkout@v1
with:
submodules: 'true'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
Expand Down Expand Up @@ -40,6 +43,30 @@ jobs:
# 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
# https://github.com/numpy/numpy/issues/21211
array_api_tests/test_special_cases.py::test_iop[__iadd__(x1_i is -0 and x2_i is -0) -> -0]
# https://github.com/numpy/numpy/issues/21213
array_api_tests/test_special_cases.py::test_iop[__ipow__(x1_i is -infinity and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +infinity]
array_api_tests/test_special_cases.py::test_iop[__ipow__(x1_i is -0 and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +0]
# noted diversions from spec
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is +infinity and isfinite(x2_i) and x2_i > 0) -> +infinity]
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is +infinity and isfinite(x2_i) and x2_i < 0) -> -infinity]
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is -infinity and isfinite(x2_i) and x2_i > 0) -> -infinity]
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is -infinity and isfinite(x2_i) and x2_i < 0) -> +infinity]
array_api_tests/test_special_cases.py::test_binary[floor_divide(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
array_api_tests/test_special_cases.py::test_binary[floor_divide(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i > 0) -> +infinity]
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i < 0) -> -infinity]
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i > 0) -> -infinity]
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i < 0) -> +infinity]
array_api_tests/test_special_cases.py::test_binary[__floordiv__(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
array_api_tests/test_special_cases.py::test_binary[__floordiv__(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i > 0) -> +infinity]
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i < 0) -> -infinity]
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i > 0) -> -infinity]
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i < 0) -> +infinity]
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
EOF
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "array_api_tests/array-api"]
path = array-api
url = https://github.com/data-apis/array-api/
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ welcome!

### Setup

Currently we pin the Array API specification repo [`array-api`](https://github.com/data-apis/array-api/)
as a git submodule. This might change in the future to better support vendoring
use cases (see [#107](https://github.com/data-apis/array-api-tests/issues/107)),
but for now be sure submodules are pulled too, e.g.

```bash
$ git submodule update --init
```

To run the tests, install the testing dependencies.

```bash
Expand Down
1 change: 1 addition & 0 deletions array-api
Submodule array-api added at 2b9c40
10 changes: 10 additions & 0 deletions array_api_tests/meta/test_special_cases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import math

from ..test_special_cases import parse_result


def test_parse_result():
check_result, _ = parse_result(
"an implementation-dependent approximation to ``+3π/4``"
)
assert check_result(3 * math.pi / 4)
Empty file.
53 changes: 0 additions & 53 deletions array_api_tests/special_cases/test_abs.py

This file was deleted.

66 changes: 0 additions & 66 deletions array_api_tests/special_cases/test_acos.py

This file was deleted.

66 changes: 0 additions & 66 deletions array_api_tests/special_cases/test_acosh.py

This file was deleted.

Loading

0 comments on commit 5f2551c

Please sign in to comment.