summaryrefslogtreecommitdiff
path: root/tests/float/math_dunder.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/float/math_dunder.py')
-rw-r--r--tests/float/math_dunder.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/float/math_dunder.py b/tests/float/math_dunder.py
new file mode 100644
index 000000000..33ea7f7c1
--- /dev/null
+++ b/tests/float/math_dunder.py
@@ -0,0 +1,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()))