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

Method test_polyder

numpy/polynomial/tests/test_polynomial.py:402–425  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

400class TestDerivative:
401
402 def test_polyder(self):
403 # check exceptions
404 assert_raises(TypeError, poly.polyder, [0], .5)
405 assert_raises(ValueError, poly.polyder, [0], -1)
406
407 # check that zeroth derivative does nothing
408 for i in range(5):
409 tgt = [0]*i + [1]
410 res = poly.polyder(tgt, m=0)
411 assert_equal(trim(res), trim(tgt))
412
413 # check that derivation is the inverse of integration
414 for i in range(5):
415 for j in range(2, 5):
416 tgt = [0]*i + [1]
417 res = poly.polyder(poly.polyint(tgt, m=j), m=j)
418 assert_almost_equal(trim(res), trim(tgt))
419
420 # check derivation with scaling
421 for i in range(5):
422 for j in range(2, 5):
423 tgt = [0]*i + [1]
424 res = poly.polyder(poly.polyint(tgt, m=j, scl=2), m=j, scl=.5)
425 assert_almost_equal(trim(res), trim(tgt))
426
427 def test_polyder_axis(self):
428 # check that axis keyword works

Callers

nothing calls this directly

Calls 4

assert_raisesFunction · 0.90
assert_equalFunction · 0.90
assert_almost_equalFunction · 0.90
trimFunction · 0.70

Tested by

no test coverage detected