MCPcopy
hub / github.com/numpy/numpy / test_basic

Method test_basic

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

Source from the content-addressed store, hash-verified

15
16class TestCtor:
17 def test_basic(self):
18 A = np.array([[1, 2], [3, 4]])
19 mA = matrix(A)
20 assert_(np.all(mA.A == A))
21
22 B = bmat("A,A;A,A")
23 C = bmat([[A, A], [A, A]])
24 D = np.array([[1, 2, 1, 2],
25 [3, 4, 3, 4],
26 [1, 2, 1, 2],
27 [3, 4, 3, 4]])
28 assert_(np.all(B.A == D))
29 assert_(np.all(C.A == D))
30
31 E = np.array([[5, 6], [7, 8]])
32 AEresult = matrix([[1, 2, 5, 6], [3, 4, 7, 8]])
33 assert_(np.all(bmat([A, E]) == AEresult))
34
35 vec = np.arange(5)
36 mvec = matrix(vec)
37 assert_(mvec.shape == (1, 5))
38
39 def test_exceptions(self):
40 # 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