Skip to content

Commit bb28167

Browse files
committed
Fix incorrect merge conflict resolution
1 parent 4d4d536 commit bb28167

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

array_api_strict/_array_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def __array__(self, dtype: None | np.dtype[Any] = None, copy: None | bool = None
160160
# We have to allow this to be internally enabled as there's no other
161161
# easy way to parse a list of Array objects in asarray().
162162
if _allow_array:
163-
if self._device != CPU_DEVICE:
164-
raise RuntimeError(f"Can not convert array on the '{self._device}' device to a Numpy array.")
163+
if self._device != CPU_DEVICE:
164+
raise RuntimeError(f"Can not convert array on the '{self._device}' device to a Numpy array.")
165165
# copy keyword is new in 2.0.0; for older versions don't use it
166166
# retry without that keyword.
167167
if np.__version__[0] < '2':

array_api_strict/tests/test_array_object.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,17 @@ def test_array_properties():
353353

354354
def test_array_conversion():
355355
# Check that arrays on the CPU device can be converted to NumPy
356-
# but arrays on other devices can't
356+
# but arrays on other devices can't. Note this is testing the logic in
357+
# __array__, which is only used in asarray when converting lists of
358+
# arrays.
357359
a = ones((2, 3))
358-
np.asarray(a)
360+
asarray([a])
359361

360362
for device in ("device1", "device2"):
361363
a = ones((2, 3), device=array_api_strict.Device(device))
362364
with pytest.raises(RuntimeError, match="Can not convert array"):
363-
np.asarray(a)
365+
asarray([a])
366+
364367
def test_allow_newaxis():
365368
a = ones(5)
366369
indexed_a = a[None, :]

0 commit comments

Comments
 (0)