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

Method test_bmat_nondefault_str

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

Source from the content-addressed store, hash-verified

37 assert_raises(ValueError, matrix, "invalid")
38
39 def test_bmat_nondefault_str(self):
40 A = np.array([[1, 2], [3, 4]])
41 B = np.array([[5, 6], [7, 8]])
42 Aresult = np.array([[1, 2, 1, 2],
43 [3, 4, 3, 4],
44 [1, 2, 1, 2],
45 [3, 4, 3, 4]])
46 mixresult = np.array([[1, 2, 5, 6],
47 [3, 4, 7, 8],
48 [5, 6, 1, 2],
49 [7, 8, 3, 4]])
50 assert_(np.all(bmat("A,A;A,A") == Aresult))
51 assert_(np.all(bmat("A,A;A,A", ldict={'A':B}) == Aresult))
52 assert_raises(TypeError, bmat, "A,A;A,A", gdict={'A':B})
53 assert_(
54 np.all(bmat("A,A;A,A", ldict={'A':A}, gdict={'A':B}) == Aresult))
55 b2 = bmat("A,B;C,D", ldict={'A':A,'B':B}, gdict={'C':B,'D':A})
56 assert_(np.all(b2 == mixresult))
57
58
59class TestProperties:

Callers

nothing calls this directly

Calls 4

assert_Function · 0.90
bmatFunction · 0.90
assert_raisesFunction · 0.90
allMethod · 0.45

Tested by

no test coverage detected