From 213a7189537fc7b9cc96f0259e5b7b9e46121927 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 19 Jan 2017 23:37:21 +1100 Subject: [PATCH] tests/float: Add test for assigning to attribute of complex number. --- tests/float/complex1.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/float/complex1.py b/tests/float/complex1.py index 027d12583c..fed65d5d54 100644 --- a/tests/float/complex1.py +++ b/tests/float/complex1.py @@ -51,6 +51,12 @@ print(float('-inf') * (1 + 1j)) # convert bignum to complex on rhs ans = 1j + (1 << 70); print("%.5g %.5g" % (ans.real, ans.imag)) +# can't assign to attributes +try: + (1j).imag = 0 +except AttributeError: + print('AttributeError') + # can't convert rhs to complex try: 1j + []