(self)
| 327 | class TestDerivative: |
| 328 | |
| 329 | def test_hermeder(self): |
| 330 | # check exceptions |
| 331 | assert_raises(TypeError, herme.hermeder, [0], .5) |
| 332 | assert_raises(ValueError, herme.hermeder, [0], -1) |
| 333 | |
| 334 | # check that zeroth derivative does nothing |
| 335 | for i in range(5): |
| 336 | tgt = [0] * i + [1] |
| 337 | res = herme.hermeder(tgt, m=0) |
| 338 | assert_equal(trim(res), trim(tgt)) |
| 339 | |
| 340 | # check that derivation is the inverse of integration |
| 341 | for i in range(5): |
| 342 | for j in range(2, 5): |
| 343 | tgt = [0] * i + [1] |
| 344 | res = herme.hermeder(herme.hermeint(tgt, m=j), m=j) |
| 345 | assert_almost_equal(trim(res), trim(tgt)) |
| 346 | |
| 347 | # check derivation with scaling |
| 348 | for i in range(5): |
| 349 | for j in range(2, 5): |
| 350 | tgt = [0] * i + [1] |
| 351 | res = herme.hermeder( |
| 352 | herme.hermeint(tgt, m=j, scl=2), m=j, scl=.5) |
| 353 | assert_almost_equal(trim(res), trim(tgt)) |
| 354 | |
| 355 | def test_hermeder_axis(self): |
| 356 | # check that axis keyword works |
nothing calls this directly
no test coverage detected