tests/float: Add test for assigning to attribute of complex number.

This commit is contained in:
Damien George 2017-01-19 23:37:21 +11:00
parent e873243aa3
commit 213a718953
1 changed files with 6 additions and 0 deletions

View File

@ -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 + []