Skip to content

Commit 9b6c209

Browse files
committed
TST: Fixup test to use array rather than asarray
asarray did not support `copy=` on older versions of NumPy
1 parent 4ac6323 commit 9b6c209

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/tests/base/test_conversion.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ def test_to_numpy(arr, expected, index_or_series_or_array, request):
363363
result = np.asarray(thing)
364364
tm.assert_numpy_array_equal(result, expected)
365365

366-
# Additionally, we check the `copy=` semantics for asarray
366+
# Additionally, we check the `copy=` semantics for array/asarray
367367
# (these are implemented by us via `__array__`).
368-
result_cp1 = np.asarray(thing, copy=True)
369-
result_cp2 = np.asarray(thing, copy=True)
368+
result_cp1 = np.array(thing, copy=True)
369+
result_cp2 = np.array(thing, copy=True)
370370
# When called with `copy=True` NumPy/we should ensure a copy was made
371371
assert not np.may_share_memory(result_cp1, result_cp2)
372372

@@ -375,12 +375,12 @@ def test_to_numpy(arr, expected, index_or_series_or_array, request):
375375
return
376376

377377
try:
378-
result_nocopy1 = np.asarray(thing, copy=False)
378+
result_nocopy1 = np.array(thing, copy=False)
379379
except ValueError:
380380
# An error is always acceptable for `copy=False`
381381
return
382382

383-
result_nocopy2 = np.asarray(thing, copy=False)
383+
result_nocopy2 = np.array(thing, copy=False)
384384
# If copy=False was given, these must share the same data
385385
assert np.may_share_memory(result_nocopy1, result_nocopy2)
386386

0 commit comments

Comments
 (0)