Skip to content

Commit 26bc1d4

Browse files
committed
Rudimentary test_stack
1 parent 216f8b7 commit 26bc1d4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

array_api_tests/test_type_promotion.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ def test_concat(shape, dtypes, kw, data):
7777
assert out.dtype == expected, f'{out.dtype=!s}, but should be {expected}'
7878

7979

80+
@given(
81+
shape=hh.shapes(),
82+
dtypes=multi_promotable_dtypes(),
83+
kw=hh.kwargs(axis=st.just(0)),
84+
data=st.data(),
85+
)
86+
def test_stack(shape, dtypes, kw, data):
87+
arrays = []
88+
for i, dtype in enumerate(dtypes, 1):
89+
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f'x{i}')
90+
arrays.append(x)
91+
out = xp.stack(arrays, **kw)
92+
expected = dh.result_type(*dtypes)
93+
assert out.dtype == expected, f'{out.dtype=!s}, but should be {expected}'
94+
95+
8096
bitwise_shift_funcs = [
8197
'bitwise_left_shift',
8298
'bitwise_right_shift',

0 commit comments

Comments
 (0)