diff options
author | David Warde-Farley <wardefar@iro.umontreal.ca> | 2012-10-25 18:57:53 -0400 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-06-08 17:20:22 -0600 |
commit | 18e7f40e97cae555f0446da99180525a8d259d81 (patch) | |
tree | 3f3beda2389e6cb6dd64c9da7178f538a525fb30 | |
parent | d661960b3489c83485a3aa83e909e2ee603e7422 (diff) | |
download | numpy-18e7f40e97cae555f0446da99180525a8d259d81.tar.gz |
TST: expected behaviour of .copy()
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 87903c28a..232734b84 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -642,6 +642,30 @@ class TestMethods(TestCase): d.sort() assert_equal(d, c, "test sort with default axis") + def test_copy(self): + def assert_fortran(arr): + assert_(arr.flags.fortran) + assert_(arr.flags.f_contiguous) + assert_(not arr.flags.c_contiguous) + + def assert_c(arr): + assert_(not arr.flags.fortran) + assert_(not arr.flags.f_contiguous) + assert_(arr.flags.c_contiguous) + + a = np.empty((2, 2), order='F') + # Test copying a Fortran array + assert_c(a.copy()) + assert_c(a.copy('C')) + assert_fortran(a.copy('F')) + assert_fortran(a.copy('A')) + + # Now test starting with a C array. + a = np.empty((2, 2), order='C') + assert_c(a.copy()) + assert_c(a.copy('C')) + assert_fortran(a.copy('F')) + assert_c(a.copy('A')) def test_sort_order(self): # Test sorting an array with fields |