diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/float/cmath_fun.py | 6 | ||||
| -rw-r--r-- | tests/float/complex_special_mehods.py | 15 | ||||
| -rwxr-xr-x | tests/run-tests | 1 |
3 files changed, 22 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()) diff --git a/tests/run-tests b/tests/run-tests index f9e4de4b3..102b0f779 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -355,6 +355,7 @@ def run_tests(pyb, tests, args, base_path="."): if not has_complex: skip_tests.add('float/complex1.py') skip_tests.add('float/complex1_intbig.py') + skip_tests.add('float/complex_special_mehods.py') skip_tests.add('float/int_big_float.py') skip_tests.add('float/true_value.py') skip_tests.add('float/types.py') |
