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

Method test_comparisons

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

Source from the content-addressed store, hash-verified

146 assert_almost_equal(x.I, xpinv)
147
148 def test_comparisons(self):
149 A = np.arange(100).reshape(10, 10)
150 mA = matrix(A)
151 mB = matrix(A) + 0.1
152 assert_(np.all(mB == A+0.1))
153 assert_(np.all(mB == matrix(A+0.1)))
154 assert_(not np.any(mB == matrix(A-0.1)))
155 assert_(np.all(mA < mB))
156 assert_(np.all(mA <= mB))
157 assert_(np.all(mA <= mA))
158 assert_(not np.any(mA < mA))
159
160 assert_(not np.any(mB < mA))
161 assert_(np.all(mB >= mA))
162 assert_(np.all(mB >= mB))
163 assert_(not np.any(mB > mB))
164
165 assert_(np.all(mA == mA))
166 assert_(not np.any(mA == mB))
167 assert_(np.all(mB != mA))
168
169 assert_(not np.all(abs(mA) > 0))
170 assert_(np.all(abs(mB > 0)))
171
172 def test_asmatrix(self):
173 A = np.arange(100).reshape(10, 10)

Callers

nothing calls this directly

Calls 6

matrixClass · 0.90
assert_Function · 0.90
absFunction · 0.85
reshapeMethod · 0.80
allMethod · 0.45
anyMethod · 0.45

Tested by

no test coverage detected