Skip to content

Commit 0945bea

Browse files
committed
Test that isin output is C-contiguous when input is strided
1 parent dc77b96 commit 0945bea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dpctl/tests/test_tensor_isin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ def test_isin_strided(dtype):
111111
assert not dpt.any(r1[:, -1])
112112
assert not dpt.any(x[:, 1::2])
113113
assert r1.shape == x_s.shape
114+
assert r1.flags.c_contiguous
114115

115116
# test with invert keyword
116117
r2 = dpt.isin(x_s, test, invert=True)
117118
assert not dpt.any(r2[:, :-1])
118119
assert dpt.all(r2[:, -1])
119120
assert not dpt.any(x[:, 1:2])
120121
assert r2.shape == x_s.shape
122+
assert r2.flags.c_contiguous
121123

122124

123125
def test_isin_strided_bool():
@@ -133,13 +135,15 @@ def test_isin_strided_bool():
133135
assert not dpt.any(r1[:, -1])
134136
assert not dpt.any(x[:, 1::2])
135137
assert r1.shape == x_s.shape
138+
assert r1.flags.c_contiguous
136139

137140
# test with invert keyword
138141
r2 = dpt.isin(x_s, test, invert=True)
139142
assert not dpt.any(r2[:, :-1])
140143
assert dpt.all(r2[:, -1])
141144
assert not dpt.any(x[:, 1:2])
142145
assert r2.shape == x_s.shape
146+
assert r2.flags.c_contiguous
143147

144148

145149
@pytest.mark.parametrize("dt1", _numeric_dtypes)

0 commit comments

Comments
 (0)