summaryrefslogtreecommitdiff
path: root/numpy/array_api/tests/test_creation_functions.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-11-15 10:26:04 +0200
committerGitHub <noreply@github.com>2021-11-15 10:26:04 +0200
commit7125cdfa21081b91907a65b6c888791cf150a0b2 (patch)
tree657688524789231600c21a3ae86157628ce7ea26 /numpy/array_api/tests/test_creation_functions.py
parenta1813504ad44b70fb139181a9df8465bcb22e24d (diff)
parentf058aea694327b517eb5c3d786c7f6a3e9c9898d (diff)
downloadnumpy-7125cdfa21081b91907a65b6c888791cf150a0b2.tar.gz
Merge pull request #19173 from czgdp1807/never_copy
ENH: Add support for copy modes to NumPy
Diffstat (limited to 'numpy/array_api/tests/test_creation_functions.py')
-rw-r--r--numpy/array_api/tests/test_creation_functions.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/numpy/array_api/tests/test_creation_functions.py b/numpy/array_api/tests/test_creation_functions.py
index ebbb6aab3..be9eaa383 100644
--- a/numpy/array_api/tests/test_creation_functions.py
+++ b/numpy/array_api/tests/test_creation_functions.py
@@ -43,12 +43,18 @@ def test_asarray_copy():
a[0] = 0
assert all(b[0] == 1)
assert all(a[0] == 0)
- # Once copy=False is implemented, replace this with
- # a = asarray([1])
- # b = asarray(a, copy=False)
- # a[0] = 0
- # assert all(b[0] == 0)
+ a = asarray([1])
+ b = asarray(a, copy=np._CopyMode.ALWAYS)
+ a[0] = 0
+ assert all(b[0] == 1)
+ assert all(a[0] == 0)
+ a = asarray([1])
+ b = asarray(a, copy=np._CopyMode.NEVER)
+ a[0] = 0
+ assert all(b[0] == 0)
assert_raises(NotImplementedError, lambda: asarray(a, copy=False))
+ assert_raises(NotImplementedError,
+ lambda: asarray(a, copy=np._CopyMode.IF_NEEDED))
def test_arange_errors():