MCPcopy Create free account
hub / github.com/numpy/numpy / test_basic

Method test_basic

numpy/matrixlib/tests/test_defmatrix.py:13–33  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

11
12class TestCtor:
13 def test_basic(self):
14 A = np.array([[1, 2], [3, 4]])
15 mA = matrix(A)
16 assert_(np.all(mA.A == A))
17
18 B = bmat("A,A;A,A")
19 C = bmat([[A, A], [A, A]])
20 D = np.array([[1, 2, 1, 2],
21 [3, 4, 3, 4],
22 [1, 2, 1, 2],
23 [3, 4, 3, 4]])
24 assert_(np.all(B.A == D))
25 assert_(np.all(C.A == D))
26
27 E = np.array([[5, 6], [7, 8]])
28 AEresult = matrix([[1, 2, 5, 6], [3, 4, 7, 8]])
29 assert_(np.all(bmat([A, E]) == AEresult))
30
31 vec = np.arange(5)
32 mvec = matrix(vec)
33 assert_(mvec.shape == (1, 5))
34
35 def test_exceptions(self):
36 # Check for ValueError when called with invalid string data.

Callers

nothing calls this directly

Calls 4

matrixClass · 0.90
assert_Function · 0.90
bmatFunction · 0.90
allMethod · 0.45

Tested by

no test coverage detected