Skip to content

Commit 5f2551c

Browse files
authored
Merge pull request #104 from honno/rst-spec
Utilise RST conversion of spec, generate runtime special cases tests
2 parents 41c338b + 6642522 commit 5f2551c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1440
-5384
lines changed

.github/workflows/numpy.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ jobs:
1111
python-version: [3.8, 3.9]
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- name: Checkout array-api-tests
15+
uses: actions/checkout@v1
16+
with:
17+
submodules: 'true'
1518
- name: Set up Python ${{ matrix.python-version }}
1619
uses: actions/setup-python@v1
1720
with:
@@ -40,6 +43,30 @@ jobs:
4043
# waiting on NumPy to allow/revert distinct NaNs for np.unique
4144
# https://github.com/numpy/numpy/issues/20326#issuecomment-1012380448
4245
array_api_tests/test_set_functions.py
46+
# https://github.com/numpy/numpy/issues/21211
47+
array_api_tests/test_special_cases.py::test_iop[__iadd__(x1_i is -0 and x2_i is -0) -> -0]
48+
# https://github.com/numpy/numpy/issues/21213
49+
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]
50+
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]
51+
# noted diversions from spec
52+
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is +infinity and isfinite(x2_i) and x2_i > 0) -> +infinity]
53+
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is +infinity and isfinite(x2_i) and x2_i < 0) -> -infinity]
54+
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is -infinity and isfinite(x2_i) and x2_i > 0) -> -infinity]
55+
array_api_tests/test_special_cases.py::test_binary[floor_divide(x1_i is -infinity and isfinite(x2_i) and x2_i < 0) -> +infinity]
56+
array_api_tests/test_special_cases.py::test_binary[floor_divide(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
57+
array_api_tests/test_special_cases.py::test_binary[floor_divide(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
58+
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i > 0) -> +infinity]
59+
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i < 0) -> -infinity]
60+
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i > 0) -> -infinity]
61+
array_api_tests/test_special_cases.py::test_binary[__floordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i < 0) -> +infinity]
62+
array_api_tests/test_special_cases.py::test_binary[__floordiv__(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
63+
array_api_tests/test_special_cases.py::test_binary[__floordiv__(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
64+
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i > 0) -> +infinity]
65+
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is +infinity and isfinite(x2_i) and x2_i < 0) -> -infinity]
66+
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i > 0) -> -infinity]
67+
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is -infinity and isfinite(x2_i) and x2_i < 0) -> +infinity]
68+
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
69+
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
4370
4471
EOF
4572

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "array_api_tests/array-api"]
2+
path = array-api
3+
url = https://github.com/data-apis/array-api/

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ welcome!
1010

1111
### Setup
1212

13+
Currently we pin the Array API specification repo [`array-api`](https://github.com/data-apis/array-api/)
14+
as a git submodule. This might change in the future to better support vendoring
15+
use cases (see [#107](https://github.com/data-apis/array-api-tests/issues/107)),
16+
but for now be sure submodules are pulled too, e.g.
17+
18+
```bash
19+
$ git submodule update --init
20+
```
21+
1322
To run the tests, install the testing dependencies.
1423

1524
```bash

array-api

Submodule array-api added at 2b9c402
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import math
2+
3+
from ..test_special_cases import parse_result
4+
5+
6+
def test_parse_result():
7+
check_result, _ = parse_result(
8+
"an implementation-dependent approximation to ``+3π/4``"
9+
)
10+
assert check_result(3 * math.pi / 4)

array_api_tests/special_cases/__init__.py

Whitespace-only changes.

array_api_tests/special_cases/test_abs.py

-53
This file was deleted.

array_api_tests/special_cases/test_acos.py

-66
This file was deleted.

array_api_tests/special_cases/test_acosh.py

-66
This file was deleted.

0 commit comments

Comments
 (0)