summaryrefslogtreecommitdiff
path: root/tests/float/complex1.py
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2021-03-15 19:27:36 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2021-03-15 19:27:36 +0530
commita52eb88031620a81521b937f2a0651dbac2bb350 (patch)
tree017cbf8f686b252241182ef61ce48e8457aa1577 /tests/float/complex1.py
parent090b6ba42fcdfbb16844f77892087f91aa6ea201 (diff)
run code formatting script
Diffstat (limited to 'tests/float/complex1.py')
-rw-r--r--tests/float/complex1.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/float/complex1.py b/tests/float/complex1.py
index 479b4b348..e6338551c 100644
--- a/tests/float/complex1.py
+++ b/tests/float/complex1.py
@@ -27,18 +27,23 @@ print(1j * 2j)
print(1j / 2)
print((1j / 2j).real)
print(1j / (1 + 2j))
-ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag))
+ans = 0j ** 0
+print("%.5g %.5g" % (ans.real, ans.imag))
+ans = 0j ** 1
+print("%.5g %.5g" % (ans.real, ans.imag))
+ans = 0j ** 0j
+print("%.5g %.5g" % (ans.real, ans.imag))
+ans = 1j ** 2.5
+print("%.5g %.5g" % (ans.real, ans.imag))
+ans = 1j ** 2.5j
+print("%.5g %.5g" % (ans.real, ans.imag))
# comparison
print(1j == 1)
print(1j == 1j)
# comparison of nan is special
-nan = float('nan') * 1j
+nan = float("nan") * 1j
print(nan == 1j)
print(nan == nan)
@@ -54,20 +59,22 @@ print(type(hash(1j)))
print(1.2 + 3j)
# negative base and fractional power should create a complex
-ans = (-1) ** 2.3; print("%.5g %.5g" % (ans.real, ans.imag))
-ans = (-1.2) ** -3.4; print("%.5g %.5g" % (ans.real, ans.imag))
+ans = (-1) ** 2.3
+print("%.5g %.5g" % (ans.real, ans.imag))
+ans = (-1.2) ** -3.4
+print("%.5g %.5g" % (ans.real, ans.imag))
# check printing of inf/nan
-print(float('nan') * 1j)
-print(float('-nan') * 1j)
-print(float('inf') * (1 + 1j))
-print(float('-inf') * (1 + 1j))
+print(float("nan") * 1j)
+print(float("-nan") * 1j)
+print(float("inf") * (1 + 1j))
+print(float("-inf") * (1 + 1j))
# can't assign to attributes
try:
(1j).imag = 0
except AttributeError:
- print('AttributeError')
+ print("AttributeError")
# can't convert rhs to complex
try:
@@ -93,11 +100,11 @@ try:
except TypeError:
print("TypeError")
-#small int on LHS, complex on RHS, unsupported op
+# small int on LHS, complex on RHS, unsupported op
try:
print(1 | 1j)
except TypeError:
- print('TypeError')
+ print("TypeError")
# zero division
try: