Skip to content

Commit fa36c20

Browse files
committed
Properly test copy=None with the dtype argument
1 parent 73047a9 commit fa36c20

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_common.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,17 @@ def test_asarray_copy(library):
115115
a[0] = 0
116116
assert all(b[0] == 0)
117117

118-
a = asarray([1])
118+
a = asarray([1.0], dtype=xp.float32)
119119
b = asarray(a, dtype=xp.float64, copy=None)
120120
assert is_lib_func(b)
121-
a[0] = 0
122-
assert all(b[0] == 1)
121+
a[0] = 0.0
122+
assert all(b[0] == 1.0)
123+
124+
a = asarray([1.0], dtype=xp.float64)
125+
b = asarray(a, dtype=xp.float64, copy=None)
126+
assert is_lib_func(b)
127+
a[0] = 0.0
128+
assert all(b[0] == 0.0)
123129

124130
# Python built-in types
125131
for obj in [True, 0, 0.0, 0j, [0], [[0]]]:

0 commit comments

Comments
 (0)