diff options
author | Damien George <damien@micropython.org> | 2020-06-22 10:21:02 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-06-27 01:03:10 +1000 |
commit | 9f911d822ee97edaa94873823db5eb10c31f5f77 (patch) | |
tree | f09d51dcfa8481f2dce415e70b9efca9c528293b /tests/float/cmath_fun.py | |
parent | 41fa8b5482089bdd7fa5478fe24f32913b23967c (diff) | |
download | micropython-9f911d822ee97edaa94873823db5eb10c31f5f77.tar.gz micropython-9f911d822ee97edaa94873823db5eb10c31f5f77.zip |
py/objcomplex: Add mp_obj_get_complex_maybe for use in complex bin-op.
This allows complex binary operations to fail gracefully with unsupported
operation rather than raising an exception, so that special methods work
correctly.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/float/cmath_fun.py')
-rw-r--r-- | tests/float/cmath_fun.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/float/cmath_fun.py b/tests/float/cmath_fun.py index 7b5e692452..15b72e7a62 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") |