Skip to content

Commit 23be1ab

Browse files
committed
Clean-up triggers
1 parent a52ddc4 commit 23be1ab

File tree

2 files changed

+57
-12
lines changed

2 files changed

+57
-12
lines changed

.github/workflows/array-api-daily.yaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
name: Array API tests (long)
22

33
on:
4-
# We would like to trigger for CI for any pull request action -
5-
# both from QuantCo's branches as well as forks.
6-
pull_request:
7-
# In addition to pull requests, we want to run CI for pushes
8-
# to the main branch and tags.
9-
push:
10-
branches:
11-
- "*"
12-
tags:
13-
- "*"
144
schedule:
15-
- cron: "0 1 * * *" # Runs weekly at 01:00 UTC each day
5+
- cron: "0 1 * * *" # Runs daily at 01:00 UTC each day
6+
push:
7+
paths:
8+
- ".github/workflows/array-api-daily.yml"
169

1710
# Automatically stop old builds on the same branch/PR
1811
concurrency:
1912
group: ${{ github.workflow }}-${{ github.ref }}
2013
cancel-in-progress: true
2114

2215
jobs:
16+
# TODO: Allow triggering this job via a comment in a PR
2317
scheduled-array-api-tests:
24-
# Run if the commit message contains 'run array-api tests' or if the job is triggered on schedule
2518
name: Array API test
2619
timeout-minutes: 360
2720
runs-on: ${{ matrix.os }}

tests/test_hypothesis_examples.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (c) QuantCo 2023-2024
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
4+
import numpy as np
5+
import pytest
6+
7+
import ndonnx as ndx
8+
9+
10+
@pytest.mark.skip(
11+
reason="NumPy is data dependent in this case but the standard leaves as UB"
12+
)
13+
def test_asarray_infer_dtype_very_large_integer():
14+
def do(npx):
15+
return npx.asarray(9223372036854775808)
16+
17+
np.testing.assert_equal(do(np), do(ndx).unwrap_numpy())
18+
19+
20+
@pytest.mark.parametrize(
21+
"start,stop,step",
22+
[
23+
(-1, 9_223_372_036_854_775_807, 288_230_376_151_711_744),
24+
(9_223_372_036_854_775_806, 9_223_372_036_854_775_807, 1),
25+
],
26+
)
27+
def test_arange(start, stop, step):
28+
def do(npx):
29+
return npx.arange(start, stop, step, dtype=npx.float32)
30+
31+
np_res = do(np)
32+
ndx_res = do(ndx).unwrap_numpy()
33+
34+
assert np_res.shape == ndx_res.shape
35+
36+
np.testing.assert_equal(np_res[0], ndx_res[0])
37+
38+
39+
def test_all():
40+
def do(npx):
41+
arr = npx.ones(shape=(0, 0), dtype=npx.bool)
42+
return npx.all(arr)
43+
44+
np.testing.assert_equal(do(np), do(ndx).unwrap_numpy())
45+
46+
47+
def test_any():
48+
def do(npx):
49+
arr = npx.ones(shape=(0, 0), dtype=npx.bool)
50+
return npx.any(arr)
51+
52+
np.testing.assert_equal(do(np), do(ndx).unwrap_numpy())

0 commit comments

Comments
 (0)