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

Function test_mul

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

Source from the content-addressed store, hash-verified

252
253
254def test_mul(Poly):
255 c1 = list(random((4,)) + .5)
256 c2 = list(random((3,)) + .5)
257 p1 = Poly(c1)
258 p2 = Poly(c2)
259 p3 = p1 * p2
260 assert_poly_almost_equal(p2 * p1, p3)
261 assert_poly_almost_equal(p1 * c2, p3)
262 assert_poly_almost_equal(c2 * p1, p3)
263 assert_poly_almost_equal(p1 * tuple(c2), p3)
264 assert_poly_almost_equal(tuple(c2) * p1, p3)
265 assert_poly_almost_equal(p1 * np.array(c2), p3)
266 assert_poly_almost_equal(np.array(c2) * p1, p3)
267 assert_poly_almost_equal(p1 * 2, p1 * Poly([2]))
268 assert_poly_almost_equal(2 * p1, p1 * Poly([2]))
269 assert_raises(TypeError, op.mul, p1, Poly([0], domain=Poly.domain + 1))
270 assert_raises(TypeError, op.mul, p1, Poly([0], window=Poly.window + 1))
271 if Poly is Polynomial:
272 assert_raises(TypeError, op.mul, p1, Chebyshev([0]))
273 else:
274 assert_raises(TypeError, op.mul, p1, Polynomial([0]))
275
276
277def test_floordiv(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