aboutsummaryrefslogtreecommitdiff
path: root/tests/float
diff options
context:
space:
mode:
Diffstat (limited to 'tests/float')
-rw-r--r--tests/float/cmath_fun.py6
-rw-r--r--tests/float/complex_special_mehods.py15
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/float/cmath_fun.py b/tests/float/cmath_fun.py
index 7b5e69245..15b72e7a6 100644
--- a/tests/float/cmath_fun.py
+++ b/tests/float/cmath_fun.py
@@ -57,3 +57,9 @@ for f_name, f, test_vals in functions:
if abs(real) < 1e-6:
real = 0.0
print("complex(%.5g, %.5g)" % (real, ret.imag))
+
+# test invalid type passed to cmath function
+try:
+ log([])
+except TypeError:
+ print("TypeError")
diff --git a/tests/float/complex_special_mehods.py b/tests/float/complex_special_mehods.py
new file mode 100644
index 000000000..6789013fa
--- /dev/null
+++ b/tests/float/complex_special_mehods.py
@@ -0,0 +1,15 @@
+# test complex interacting with special methods
+
+
+class A:
+ def __add__(self, x):
+ print("__add__")
+ return 1
+
+ def __radd__(self, x):
+ print("__radd__")
+ return 2
+
+
+print(A() + 1j)
+print(1j + A())