Skip to content

Commit 705559d

Browse files
committed
add reshape test that verifies copy semantics
1 parent 5d68d81 commit 705559d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: test/test_manip.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import numpy
55
import pytest
6-
from mpi4py import MPI
76
from utils import device, runAndCompare
87

98
import sharpy as sp
9+
from mpi4py import MPI
1010

1111

1212
class TestManip:
@@ -26,6 +26,13 @@ def doit(aapi, **kwargs):
2626

2727
assert runAndCompare(doit)
2828

29+
def test_reshape_copy(self):
30+
a = sp.arange(0, 8, 1, sp.int32)
31+
b = sp.reshape(a, [4, 2])
32+
a[0] = 20
33+
assert numpy.allclose(sp.to_numpy(a), [20, 1, 2, 3, 4, 5, 6, 7])
34+
assert numpy.allclose(sp.to_numpy(b), [[0, 1], [2, 3], [4, 5], [6, 7]])
35+
2936
@pytest.mark.skipif(len(device), reason="FIXME 64bit on GPU")
3037
def test_astype_f64i32(self):
3138
def doit(aapi, **kwargs):

0 commit comments

Comments
 (0)