1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# test that math functions support user classes with __float__ try: import math except ImportError: print("SKIP") raise SystemExit class TestFloat: def __float__(self): return 1.0 print("%.5g" % math.exp(TestFloat()))