test_scipy_version.py 606 B

123456789101112131415161718
  1. import re
  2. import scipy
  3. from numpy.testing import assert_
  4. def test_valid_scipy_version():
  5. # Verify that the SciPy version is a valid one (no .post suffix or other
  6. # nonsense). See NumPy issue gh-6431 for an issue caused by an invalid
  7. # version.
  8. version_pattern = r"^[0-9]+\.[0-9]+\.[0-9]+(|a[0-9]|b[0-9]|rc[0-9])"
  9. dev_suffix = r"(\.dev0\+.+([0-9a-f]{7}|Unknown))"
  10. if scipy.version.release:
  11. res = re.match(version_pattern, scipy.__version__)
  12. else:
  13. res = re.match(version_pattern + dev_suffix, scipy.__version__)
  14. assert_(res is not None, scipy.__version__)