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

Function test_sub

numpy/polynomial/tests/test_classes.py:238–257  ·  view source on GitHub ↗
(Poly)

Source from the content-addressed store, hash-verified

236
237
238def test_sub(Poly):
239 # This checks commutation, not numerical correctness
240 c1 = list(random((4,)) + .5)
241 c2 = list(random((3,)) + .5)
242 p1 = Poly(c1)
243 p2 = Poly(c2)
244 p3 = p1 - p2
245 assert_poly_almost_equal(p2 - p1, -p3)
246 assert_poly_almost_equal(p1 - c2, p3)
247 assert_poly_almost_equal(c2 - p1, -p3)
248 assert_poly_almost_equal(p1 - tuple(c2), p3)
249 assert_poly_almost_equal(tuple(c2) - p1, -p3)
250 assert_poly_almost_equal(p1 - np.array(c2), p3)
251 assert_poly_almost_equal(np.array(c2) - p1, -p3)
252 assert_raises(TypeError, op.sub, p1, Poly([0], domain=Poly.domain + 1))
253 assert_raises(TypeError, op.sub, p1, Poly([0], window=Poly.window + 1))
254 if Poly is Polynomial:
255 assert_raises(TypeError, op.sub, p1, Chebyshev([0]))
256 else:
257 assert_raises(TypeError, op.sub, p1, Polynomial([0]))
258
259
260def test_mul(Poly):

Callers

nothing calls this directly

Calls 5

assert_raisesFunction · 0.90
ChebyshevClass · 0.90
PolynomialClass · 0.90
PolyFunction · 0.85
assert_poly_almost_equalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…