Skip to content

Commit b3d90a9

Browse files
committed
Move manipulation tests to their own file
1 parent 35a86f1 commit b3d90a9

File tree

2 files changed

+39
-29
lines changed

2 files changed

+39
-29
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from hypothesis import given
2+
from hypothesis import strategies as st
3+
4+
from . import _array_module as xp
5+
from . import dtype_helpers as dh
6+
from . import hypothesis_helpers as hh
7+
from . import pytest_helpers as ph
8+
from . import xps
9+
10+
11+
@given(
12+
shape=hh.shapes(min_dims=1),
13+
dtypes=hh.mutually_promotable_dtypes(None, dtypes=dh.numeric_dtypes),
14+
data=st.data(),
15+
)
16+
def test_concat(shape, dtypes, data):
17+
arrays = []
18+
for i, dtype in enumerate(dtypes, 1):
19+
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f"x{i}")
20+
arrays.append(x)
21+
out = xp.concat(arrays)
22+
ph.assert_dtype("concat", dtypes, out.dtype)
23+
# TODO
24+
25+
26+
@given(
27+
shape=hh.shapes(),
28+
dtypes=hh.mutually_promotable_dtypes(None),
29+
data=st.data(),
30+
)
31+
def test_stack(shape, dtypes, data):
32+
arrays = []
33+
for i, dtype in enumerate(dtypes, 1):
34+
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f"x{i}")
35+
arrays.append(x)
36+
out = xp.stack(arrays)
37+
ph.assert_dtype("stack", dtypes, out.dtype)
38+
# TODO

array_api_tests/test_type_promotion.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
# TODO: move tests not covering elementwise funcs/ops into standalone tests
22-
# result_type, meshgrid, concat, stack, where, tensordor, vecdot
22+
# result_type, meshgrid, where, tensordor, vecdot
2323

2424

2525
@given(hh.mutually_promotable_dtypes(None))
@@ -51,34 +51,6 @@ def test_meshgrid(dtypes, data):
5151
ph.assert_dtype("meshgrid", dtypes, x.dtype, repr_name=f"out[{i}].dtype")
5252

5353

54-
@given(
55-
shape=hh.shapes(min_dims=1),
56-
dtypes=hh.mutually_promotable_dtypes(None, dtypes=dh.numeric_dtypes),
57-
data=st.data(),
58-
)
59-
def test_concat(shape, dtypes, data):
60-
arrays = []
61-
for i, dtype in enumerate(dtypes, 1):
62-
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f"x{i}")
63-
arrays.append(x)
64-
out = xp.concat(arrays)
65-
ph.assert_dtype("concat", dtypes, out.dtype)
66-
67-
68-
@given(
69-
shape=hh.shapes(),
70-
dtypes=hh.mutually_promotable_dtypes(None),
71-
data=st.data(),
72-
)
73-
def test_stack(shape, dtypes, data):
74-
arrays = []
75-
for i, dtype in enumerate(dtypes, 1):
76-
x = data.draw(xps.arrays(dtype=dtype, shape=shape), label=f"x{i}")
77-
arrays.append(x)
78-
out = xp.stack(arrays)
79-
ph.assert_dtype("stack", dtypes, out.dtype)
80-
81-
8254
bitwise_shift_funcs = [
8355
"bitwise_left_shift",
8456
"bitwise_right_shift",

0 commit comments

Comments
 (0)