summaryrefslogtreecommitdiff
path: root/numpy/array_api/tests/test_creation_functions.py
diff options
context:
space:
mode:
authorczgdp1807 <gdp.1807@gmail.com>2021-09-03 15:10:23 +0530
committerczgdp1807 <gdp.1807@gmail.com>2021-09-03 15:10:23 +0530
commit45dbdc9d8fd3fa7fbabbddf690f6c892cc24aa1d (patch)
tree419f6ad858da3306113838ecb5d63a30d627b89e /numpy/array_api/tests/test_creation_functions.py
parent781d0a7ac61ce007e65abcd4e30f2181e729ae61 (diff)
downloadnumpy-45dbdc9d8fd3fa7fbabbddf690f6c892cc24aa1d.tar.gz
CopyMode added to np.array_api
Diffstat (limited to 'numpy/array_api/tests/test_creation_functions.py')
-rw-r--r--numpy/array_api/tests/test_creation_functions.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/numpy/array_api/tests/test_creation_functions.py b/numpy/array_api/tests/test_creation_functions.py
index 3cb8865cd..b0c99cd45 100644
--- a/numpy/array_api/tests/test_creation_functions.py
+++ b/numpy/array_api/tests/test_creation_functions.py
@@ -56,12 +56,17 @@ 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.NEVER))
def test_arange_errors():