summaryrefslogtreecommitdiff
path: root/numpy/tests
diff options
context:
space:
mode:
authorDanny Hermes <daniel.j.hermes@gmail.com>2017-11-12 11:17:12 -0800
committerEric Wieser <wieser.eric@gmail.com>2017-11-12 11:17:12 -0800
commita4e47e0205b78eb96248e71918c2558e25a9d3c7 (patch)
tree85f60a4994556e0eaf8e2fd0d4d72e2cf66ea5b7 /numpy/tests
parentd87c4197c358a898372c178f6c24f00d54eff745 (diff)
downloadnumpy-a4e47e0205b78eb96248e71918c2558e25a9d3c7.tar.gz
ENH: Add `order=` keyword to `np.eye()` (#9996)
Fixes #9995
Diffstat (limited to 'numpy/tests')
-rw-r--r--numpy/tests/test_matlib.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/numpy/tests/test_matlib.py b/numpy/tests/test_matlib.py
index 11227b19a..d16975934 100644
--- a/numpy/tests/test_matlib.py
+++ b/numpy/tests/test_matlib.py
@@ -28,10 +28,19 @@ def test_identity():
assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))
def test_eye():
- x = numpy.matlib.eye(3, k=1, dtype=int)
- assert_array_equal(x, np.matrix([[ 0, 1, 0],
- [ 0, 0, 1],
- [ 0, 0, 0]]))
+ xc = numpy.matlib.eye(3, k=1, dtype=int)
+ assert_array_equal(xc, np.matrix([[ 0, 1, 0],
+ [ 0, 0, 1],
+ [ 0, 0, 0]]))
+ assert xc.flags.c_contiguous
+ assert not xc.flags.f_contiguous
+
+ xf = numpy.matlib.eye(3, 4, dtype=int, order='F')
+ assert_array_equal(xf, np.matrix([[ 1, 0, 0, 0],
+ [ 0, 1, 0, 0],
+ [ 0, 0, 1, 0]]))
+ assert not xf.flags.c_contiguous
+ assert xf.flags.f_contiguous
def test_rand():
x = numpy.matlib.rand(3)