test_common.py 833 B

1234567891011121314151617181920212223242526
  1. from numpy.testing import assert_equal, assert_almost_equal, suppress_warnings
  2. from scipy.misc import face, ascent, electrocardiogram
  3. def test_face():
  4. with suppress_warnings() as sup:
  5. sup.filter(category=DeprecationWarning)
  6. assert_equal(face().shape, (768, 1024, 3))
  7. def test_ascent():
  8. with suppress_warnings() as sup:
  9. sup.filter(category=DeprecationWarning)
  10. assert_equal(ascent().shape, (512, 512))
  11. def test_electrocardiogram():
  12. with suppress_warnings() as sup:
  13. sup.filter(category=DeprecationWarning)
  14. # Test shape, dtype and stats of signal
  15. ecg = electrocardiogram()
  16. assert ecg.dtype == float
  17. assert_equal(ecg.shape, (108000,))
  18. assert_almost_equal(ecg.mean(), -0.16510875)
  19. assert_almost_equal(ecg.std(), 0.5992473991177294)