MCPcopy Index your code
hub / github.com/numpy/numpy / test_bmat_nondefault_str

Method test_bmat_nondefault_str

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

Source from the content-addressed store, hash-verified

41 assert_raises(ValueError, matrix, "invalid")
42
43 def test_bmat_nondefault_str(self):
44 A = np.array([[1, 2], [3, 4]])
45 B = np.array([[5, 6], [7, 8]])
46 Aresult = np.array([[1, 2, 1, 2],
47 [3, 4, 3, 4],
48 [1, 2, 1, 2],
49 [3, 4, 3, 4]])
50 mixresult = np.array([[1, 2, 5, 6],
51 [3, 4, 7, 8],
52 [5, 6, 1, 2],
53 [7, 8, 3, 4]])
54 assert_(np.all(bmat("A,A;A,A") == Aresult))
55 assert_(np.all(bmat("A,A;A,A", ldict={'A': B}) == Aresult))
56 assert_raises(TypeError, bmat, "A,A;A,A", gdict={'A': B})
57 assert_(
58 np.all(bmat("A,A;A,A", ldict={'A': A}, gdict={'A': B}) == Aresult))
59 b2 = bmat("A,B;C,D", ldict={'A': A, 'B': B}, gdict={'C': B, 'D': A})
60 assert_(np.all(b2 == mixresult))
61
62
63class 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