math_fun_bool.py 370 B

12345678910111213141516
  1. # Test the bool functions from math
  2. try:
  3. from math import isfinite, isnan, isinf
  4. except ImportError:
  5. print("SKIP")
  6. raise SystemExit
  7. test_values = [1, 0, -1, 1.0, 0.0, -1.0, float('NaN'), float('Inf'),
  8. -float('NaN'), -float('Inf')]
  9. functions = [isfinite, isnan, isinf]
  10. for val in test_values:
  11. for f in functions:
  12. print(f(val))