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

Function test_pow

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

Source from the content-addressed store, hash-verified

493
494
495def test_pow(Poly):
496 d = Poly.domain + random((2,))*.25
497 w = Poly.window + random((2,))*.25
498 tgt = Poly([1], domain=d, window=w)
499 tst = Poly([1, 2, 3], domain=d, window=w)
500 for i in range(5):
501 assert_poly_almost_equal(tst**i, tgt)
502 tgt = tgt * tst
503 # default domain and window
504 tgt = Poly([1])
505 tst = Poly([1, 2, 3])
506 for i in range(5):
507 assert_poly_almost_equal(tst**i, tgt)
508 tgt = tgt * tst
509 # check error for invalid powers
510 assert_raises(ValueError, op.pow, tgt, 1.5)
511 assert_raises(ValueError, op.pow, tgt, -1)
512
513
514def test_call(Poly):

Callers

nothing calls this directly

Calls 3

assert_raisesFunction · 0.90
PolyFunction · 0.85
assert_poly_almost_equalFunction · 0.85

Tested by

no test coverage detected