summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cpydiff/modules_random_randint.py2
-rw-r--r--tests/float/complex1.py14
-rw-r--r--tests/float/float1.py2
-rw-r--r--tests/float/float2int_doubleprec_intbig.py36
-rw-r--r--tests/float/float2int_fp30_intbig.py36
-rw-r--r--tests/float/float2int_intbig.py36
-rw-r--r--tests/float/inf_nan_arith.py2
-rw-r--r--tests/float/int_big_float.py2
-rw-r--r--tests/float/int_divzero.py2
-rw-r--r--tests/float/int_power.py2
-rw-r--r--tests/micropython/import_mpy_native_x64.py2
-rw-r--r--tests/misc/rge_sm.py12
-rw-r--r--tests/perf_bench/bm_chaos.py2
-rw-r--r--tests/perf_bench/misc_raytrace.py8
-rwxr-xr-xtests/run-perfbench.py6
15 files changed, 82 insertions, 82 deletions
diff --git a/tests/cpydiff/modules_random_randint.py b/tests/cpydiff/modules_random_randint.py
index b05908a157..90607400cd 100644
--- a/tests/cpydiff/modules_random_randint.py
+++ b/tests/cpydiff/modules_random_randint.py
@@ -8,5 +8,5 @@ workaround: If you need integers larger than native wordsize use the random modu
import random
-x = random.randint(2 ** 128 - 1, 2 ** 128)
+x = random.randint(2**128 - 1, 2**128)
print("x={}".format(x))
diff --git a/tests/float/complex1.py b/tests/float/complex1.py
index a510ffc830..139bb0c509 100644
--- a/tests/float/complex1.py
+++ b/tests/float/complex1.py
@@ -27,15 +27,15 @@ print(1j * 2j)
print(1j / 2)
print((1j / 2j).real)
print(1j / (1 + 2j))
-ans = 0j ** 0
+ans = 0j**0
print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 0j ** 1
+ans = 0j**1
print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 0j ** 0j
+ans = 0j**0j
print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 1j ** 2.5
+ans = 1j**2.5
print("%.5g %.5g" % (ans.real, ans.imag))
-ans = 1j ** 2.5j
+ans = 1j**2.5j
print("%.5g %.5g" % (ans.real, ans.imag))
# comparison
@@ -116,10 +116,10 @@ except ZeroDivisionError:
# zero division via power
try:
- 0j ** -1
+ 0j**-1
except ZeroDivisionError:
print("ZeroDivisionError")
try:
- 0j ** 1j
+ 0j**1j
except ZeroDivisionError:
print("ZeroDivisionError")
diff --git a/tests/float/float1.py b/tests/float/float1.py
index efde5146be..37f8b3face 100644
--- a/tests/float/float1.py
+++ b/tests/float/float1.py
@@ -88,7 +88,7 @@ except ZeroDivisionError:
print("ZeroDivisionError")
try:
- 0.0 ** -1
+ 0.0**-1
except ZeroDivisionError:
print("ZeroDivisionError")
diff --git a/tests/float/float2int_doubleprec_intbig.py b/tests/float/float2int_doubleprec_intbig.py
index 418eddb607..adc76d4aeb 100644
--- a/tests/float/float2int_doubleprec_intbig.py
+++ b/tests/float/float2int_doubleprec_intbig.py
@@ -35,8 +35,8 @@ if ll_type != 0:
print(int(1418774543.0))
print("%d" % 1418774543.0)
if ll_type == 3:
- print(int(2.0 ** 100))
- print("%d" % 2.0 ** 100)
+ print(int(2.0**100))
+ print("%d" % 2.0**100)
else:
print(int(1073741823.0))
print("%d" % 1073741823.0)
@@ -44,7 +44,7 @@ else:
testpass = True
p2_rng = ((30, 63, 1024), (62, 63, 1024))[is_64bit][ll_type]
for i in range(0, p2_rng):
- bitcnt = len(bin(int(2.0 ** i))) - 3
+ bitcnt = len(bin(int(2.0**i))) - 3
if i != bitcnt:
print("fail: 2**%u was %u bits long" % (i, bitcnt))
testpass = False
@@ -53,7 +53,7 @@ print("power of 2 test: %s" % (testpass and "passed" or "failed"))
testpass = True
p10_rng = ((9, 18, 23), (18, 18, 23))[is_64bit][ll_type]
for i in range(0, p10_rng):
- digcnt = len(str(int(10.0 ** i))) - 1
+ digcnt = len(str(int(10.0**i))) - 1
if i != digcnt:
print("fail: 10**%u was %u digits long" % (i, digcnt))
testpass = False
@@ -72,28 +72,28 @@ def fp2int_test(num, name, should_fail):
if ll_type != 2:
if ll_type == 0:
if is_64bit:
- neg_bad_fp = -1.00000005 * 2.0 ** 62.0
- pos_bad_fp = 2.0 ** 62.0
- neg_good_fp = -(2.0 ** 62.0)
- pos_good_fp = 0.99999993 * 2.0 ** 62.0
+ neg_bad_fp = -1.00000005 * 2.0**62.0
+ pos_bad_fp = 2.0**62.0
+ neg_good_fp = -(2.0**62.0)
+ pos_good_fp = 0.99999993 * 2.0**62.0
else:
- neg_bad_fp = -1.00000005 * 2.0 ** 30.0
- pos_bad_fp = 2.0 ** 30.0
- neg_good_fp = -(2.0 ** 30.0)
- pos_good_fp = 0.9999999499 * 2.0 ** 30.0
+ neg_bad_fp = -1.00000005 * 2.0**30.0
+ pos_bad_fp = 2.0**30.0
+ neg_good_fp = -(2.0**30.0)
+ pos_good_fp = 0.9999999499 * 2.0**30.0
else:
- neg_bad_fp = -0.51 * 2.0 ** 64.0
- pos_bad_fp = 2.0 ** 63.0
- neg_good_fp = -(2.0 ** 63.0)
- pos_good_fp = 1.9999998 * 2.0 ** 62.0
+ neg_bad_fp = -0.51 * 2.0**64.0
+ pos_bad_fp = 2.0**63.0
+ neg_good_fp = -(2.0**63.0)
+ pos_good_fp = 1.9999998 * 2.0**62.0
fp2int_test(neg_bad_fp, "neg bad", True)
fp2int_test(pos_bad_fp, "pos bad", True)
fp2int_test(neg_good_fp, "neg good", False)
fp2int_test(pos_good_fp, "pos good", False)
else:
- fp2int_test(-1.9999999999999981 * 2.0 ** 1023.0, "large neg", False)
- fp2int_test(1.9999999999999981 * 2.0 ** 1023.0, "large pos", False)
+ fp2int_test(-1.9999999999999981 * 2.0**1023.0, "large neg", False)
+ fp2int_test(1.9999999999999981 * 2.0**1023.0, "large pos", False)
fp2int_test(float("inf"), "inf test", True)
fp2int_test(float("-inf"), "inf test", True)
diff --git a/tests/float/float2int_fp30_intbig.py b/tests/float/float2int_fp30_intbig.py
index fcbe2e309f..4e3c1fa217 100644
--- a/tests/float/float2int_fp30_intbig.py
+++ b/tests/float/float2int_fp30_intbig.py
@@ -34,13 +34,13 @@ if ll_type is None:
print(int(14187744.0))
print("%d" % 14187744.0)
if ll_type == 2:
- print(int(2.0 ** 100))
- print("%d" % 2.0 ** 100)
+ print(int(2.0**100))
+ print("%d" % 2.0**100)
testpass = True
p2_rng = ((30, 63, 127), (62, 63, 127))[is_64bit][ll_type]
for i in range(0, p2_rng):
- bitcnt = len(bin(int(2.0 ** i))) - 3
+ bitcnt = len(bin(int(2.0**i))) - 3
if i != bitcnt:
print("fail: 2.**%u was %u bits long" % (i, bitcnt))
testpass = False
@@ -50,7 +50,7 @@ print("power of 2 test: %s" % (testpass and "passed" or "failed"))
testpass = True
p10_rng = 9
for i in range(0, p10_rng):
- digcnt = len(str(int(10.0 ** i))) - 1
+ digcnt = len(str(int(10.0**i))) - 1
if i != digcnt:
print("fail: 10.**%u was %u digits long" % (i, digcnt))
testpass = False
@@ -69,28 +69,28 @@ def fp2int_test(num, name, should_fail):
if ll_type != 2:
if ll_type == 0:
if is_64bit:
- neg_bad_fp = -1.00000005 * 2.0 ** 62.0
- pos_bad_fp = 2.0 ** 62.0
- neg_good_fp = -(2.0 ** 62.0)
- pos_good_fp = 0.99999993 * 2.0 ** 62.0
+ neg_bad_fp = -1.00000005 * 2.0**62.0
+ pos_bad_fp = 2.0**62.0
+ neg_good_fp = -(2.0**62.0)
+ pos_good_fp = 0.99999993 * 2.0**62.0
else:
- neg_bad_fp = -1.00000005 * 2.0 ** 30.0
- pos_bad_fp = 2.0 ** 30.0
- neg_good_fp = -(2.0 ** 30.0)
- pos_good_fp = 0.9999999499 * 2.0 ** 30.0
+ neg_bad_fp = -1.00000005 * 2.0**30.0
+ pos_bad_fp = 2.0**30.0
+ neg_good_fp = -(2.0**30.0)
+ pos_good_fp = 0.9999999499 * 2.0**30.0
else:
- neg_bad_fp = -0.51 * 2.0 ** 64.0
- pos_bad_fp = 2.0 ** 63.0
- neg_good_fp = -(2.0 ** 63.0)
- pos_good_fp = 1.9999998 * 2.0 ** 62.0
+ neg_bad_fp = -0.51 * 2.0**64.0
+ pos_bad_fp = 2.0**63.0
+ neg_good_fp = -(2.0**63.0)
+ pos_good_fp = 1.9999998 * 2.0**62.0
fp2int_test(neg_bad_fp, "neg bad", True)
fp2int_test(pos_bad_fp, "pos bad", True)
fp2int_test(neg_good_fp, "neg good", False)
fp2int_test(pos_good_fp, "pos good", False)
else:
- fp2int_test(-1.999999879 * 2.0 ** 126.0, "large neg", False)
- fp2int_test(1.999999879 * 2.0 ** 126.0, "large pos", False)
+ fp2int_test(-1.999999879 * 2.0**126.0, "large neg", False)
+ fp2int_test(1.999999879 * 2.0**126.0, "large pos", False)
fp2int_test(float("inf"), "inf test", True)
fp2int_test(float("-inf"), "inf test", True)
diff --git a/tests/float/float2int_intbig.py b/tests/float/float2int_intbig.py
index 865aeea7b9..739f98f804 100644
--- a/tests/float/float2int_intbig.py
+++ b/tests/float/float2int_intbig.py
@@ -37,13 +37,13 @@ print(int(14187745.))
print("%d" % 14187745.)
# fmt: on
if ll_type == 2:
- print(int(2.0 ** 100))
- print("%d" % 2.0 ** 100)
+ print(int(2.0**100))
+ print("%d" % 2.0**100)
testpass = True
p2_rng = ((30, 63, 127), (62, 63, 127))[is_64bit][ll_type]
for i in range(0, p2_rng):
- bitcnt = len(bin(int(2.0 ** i))) - 3
+ bitcnt = len(bin(int(2.0**i))) - 3
if i != bitcnt:
print("fail: 2.**%u was %u bits long" % (i, bitcnt))
testpass = False
@@ -53,7 +53,7 @@ print("power of 2 test: %s" % (testpass and "passed" or "failed"))
testpass = True
p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11
for i in range(0, p10_rng):
- digcnt = len(str(int(10.0 ** i))) - 1
+ digcnt = len(str(int(10.0**i))) - 1
if i != digcnt:
print("fail: 10.**%u was %u digits long" % (i, digcnt))
testpass = False
@@ -72,28 +72,28 @@ def fp2int_test(num, name, should_fail):
if ll_type != 2:
if ll_type == 0:
if is_64bit:
- neg_bad_fp = -1.00000005 * 2.0 ** 62.0
- pos_bad_fp = 2.0 ** 62.0
- neg_good_fp = -(2.0 ** 62.0)
- pos_good_fp = 0.99999993 * 2.0 ** 62.0
+ neg_bad_fp = -1.00000005 * 2.0**62.0
+ pos_bad_fp = 2.0**62.0
+ neg_good_fp = -(2.0**62.0)
+ pos_good_fp = 0.99999993 * 2.0**62.0
else:
- neg_bad_fp = -1.00000005 * 2.0 ** 30.0
- pos_bad_fp = 2.0 ** 30.0
- neg_good_fp = -(2.0 ** 30.0)
- pos_good_fp = 0.9999999499 * 2.0 ** 30.0
+ neg_bad_fp = -1.00000005 * 2.0**30.0
+ pos_bad_fp = 2.0**30.0
+ neg_good_fp = -(2.0**30.0)
+ pos_good_fp = 0.9999999499 * 2.0**30.0
else:
- neg_bad_fp = -0.51 * 2.0 ** 64.0
- pos_bad_fp = 2.0 ** 63.0
- neg_good_fp = -(2.0 ** 63.0)
- pos_good_fp = 1.9999998 * 2.0 ** 62.0
+ neg_bad_fp = -0.51 * 2.0**64.0
+ pos_bad_fp = 2.0**63.0
+ neg_good_fp = -(2.0**63.0)
+ pos_good_fp = 1.9999998 * 2.0**62.0
fp2int_test(neg_bad_fp, "neg bad", True)
fp2int_test(pos_bad_fp, "pos bad", True)
fp2int_test(neg_good_fp, "neg good", False)
fp2int_test(pos_good_fp, "pos good", False)
else:
- fp2int_test(-1.999999879 * 2.0 ** 127.0, "large neg", False)
- fp2int_test(1.999999879 * 2.0 ** 127.0, "large pos", False)
+ fp2int_test(-1.999999879 * 2.0**127.0, "large neg", False)
+ fp2int_test(1.999999879 * 2.0**127.0, "large pos", False)
fp2int_test(float("inf"), "inf test", True)
fp2int_test(float("nan"), "NaN test", True)
diff --git a/tests/float/inf_nan_arith.py b/tests/float/inf_nan_arith.py
index c27e38bc52..d1a6b18872 100644
--- a/tests/float/inf_nan_arith.py
+++ b/tests/float/inf_nan_arith.py
@@ -14,7 +14,7 @@ for x in values:
except ZeroDivisionError:
print(" / ZeroDivisionError")
try:
- print(" ** pow", x ** y, pow(x, y))
+ print(" ** pow", x**y, pow(x, y))
except ZeroDivisionError:
print(" ** pow ZeroDivisionError")
print(" == != < <= > >=", x == y, x != y, x < y, x <= y, x > y, x >= y)
diff --git a/tests/float/int_big_float.py b/tests/float/int_big_float.py
index 0bd1662186..dc13e8e0dd 100644
--- a/tests/float/int_big_float.py
+++ b/tests/float/int_big_float.py
@@ -19,7 +19,7 @@ print("%.5g" % (i / 1.2))
print("%.5g" % (i * 1.2j).imag)
# negative power should produce float
-print("%.5g" % (i ** -1))
+print("%.5g" % (i**-1))
print("%.5g" % ((2 + i - i) ** -3))
try:
diff --git a/tests/float/int_divzero.py b/tests/float/int_divzero.py
index b311a1dbcf..ef3531bee8 100644
--- a/tests/float/int_divzero.py
+++ b/tests/float/int_divzero.py
@@ -4,6 +4,6 @@ except ZeroDivisionError:
print("ZeroDivisionError")
try:
- 0 ** -1
+ 0**-1
except ZeroDivisionError:
print("ZeroDivisionError")
diff --git a/tests/float/int_power.py b/tests/float/int_power.py
index ba79247a56..bcda0f98ed 100644
--- a/tests/float/int_power.py
+++ b/tests/float/int_power.py
@@ -1,7 +1,7 @@
# negative power should produce float
x = 2
-print(x ** -2)
+print(x**-2)
x = 3
x **= -2
diff --git a/tests/micropython/import_mpy_native_x64.py b/tests/micropython/import_mpy_native_x64.py
index cad59e9916..ff0142a9cf 100644
--- a/tests/micropython/import_mpy_native_x64.py
+++ b/tests/micropython/import_mpy_native_x64.py
@@ -9,7 +9,7 @@ except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
-if not (usys.platform == "linux" and usys.maxsize > 2 ** 32):
+if not (usys.platform == "linux" and usys.maxsize > 2**32):
print("SKIP")
raise SystemExit
diff --git a/tests/misc/rge_sm.py b/tests/misc/rge_sm.py
index f3bb4189f7..00b0a7a021 100644
--- a/tests/misc/rge_sm.py
+++ b/tests/misc/rge_sm.py
@@ -52,12 +52,12 @@ class RungeKutta(object):
# couplings are: g1, g2, g3 of U(1), SU(2), SU(3); yt (top Yukawa), lambda (Higgs quartic)
# see arxiv.org/abs/0812.4950, eqs 10-15
sysSM = (
- lambda *a: 41.0 / 96.0 / math.pi ** 2 * a[1] ** 3, # g1
- lambda *a: -19.0 / 96.0 / math.pi ** 2 * a[2] ** 3, # g2
- lambda *a: -42.0 / 96.0 / math.pi ** 2 * a[3] ** 3, # g3
+ lambda *a: 41.0 / 96.0 / math.pi**2 * a[1] ** 3, # g1
+ lambda *a: -19.0 / 96.0 / math.pi**2 * a[2] ** 3, # g2
+ lambda *a: -42.0 / 96.0 / math.pi**2 * a[3] ** 3, # g3
lambda *a: 1.0
/ 16.0
- / math.pi ** 2
+ / math.pi**2
* (
9.0 / 2.0 * a[4] ** 3
- 8.0 * a[3] ** 2 * a[4]
@@ -66,7 +66,7 @@ sysSM = (
), # yt
lambda *a: 1.0
/ 16.0
- / math.pi ** 2
+ / math.pi**2
* (
24.0 * a[5] ** 2
+ 12.0 * a[4] ** 2 * a[5]
@@ -137,5 +137,5 @@ def singleTraj(system, trajStart, h=0.02, tend=1.0):
# initial conditions at M_Z
singleTraj(
- sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10 ** 17)
+ sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)
) # true values
diff --git a/tests/perf_bench/bm_chaos.py b/tests/perf_bench/bm_chaos.py
index 55d282561f..d0f1337db7 100644
--- a/tests/perf_bench/bm_chaos.py
+++ b/tests/perf_bench/bm_chaos.py
@@ -15,7 +15,7 @@ class GVector(object):
self.z = z
def Mag(self):
- return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
+ return math.sqrt(self.x**2 + self.y**2 + self.z**2)
def dist(self, other):
return math.sqrt(
diff --git a/tests/perf_bench/misc_raytrace.py b/tests/perf_bench/misc_raytrace.py
index b51acaccac..a729af99c2 100644
--- a/tests/perf_bench/misc_raytrace.py
+++ b/tests/perf_bench/misc_raytrace.py
@@ -22,7 +22,7 @@ class Vec:
return Vec(self.x * rhs, self.y * rhs, self.z * rhs)
def length(self):
- return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5
+ return (self.x**2 + self.y**2 + self.z**2) ** 0.5
def normalise(self):
l = self.length()
@@ -87,12 +87,12 @@ class Sphere:
def __init__(self, surface, centre, radius):
self.surface = surface
self.centre = centre
- self.radsq = radius ** 2
+ self.radsq = radius**2
def intersect(self, ray):
v = self.centre - ray.p
b = v.dot(ray.d)
- det = b ** 2 - v.dot(v) + self.radsq
+ det = b**2 - v.dot(v) + self.radsq
if det > 0:
det **= 0.5
t1 = b - det
@@ -180,7 +180,7 @@ def trace_ray(scene, ray, depth):
if ndotl > 0:
col += light_col * surf.diffuse * ndotl
if ldotv > 0:
- col += light_col * surf.specular * ldotv ** surf.spec_idx
+ col += light_col * surf.specular * ldotv**surf.spec_idx
# Reflections
if depth > 0 and surf.reflect > 0:
diff --git a/tests/run-perfbench.py b/tests/run-perfbench.py
index bcdbe69abb..5f299281fd 100755
--- a/tests/run-perfbench.py
+++ b/tests/run-perfbench.py
@@ -33,8 +33,8 @@ def compute_stats(lst):
avg += x
var += x * x
avg /= len(lst)
- var = max(0, var / len(lst) - avg ** 2)
- return avg, var ** 0.5
+ var = max(0, var / len(lst) - avg**2)
+ return avg, var**0.5
def run_script_on_target(target, script):
@@ -201,7 +201,7 @@ def compute_diff(file1, file2, diff_score):
sd1 *= av1 / 100 # convert from percent sd to absolute sd
sd2 *= av2 / 100 # convert from percent sd to absolute sd
av_diff = av2 - av1
- sd_diff = (sd1 ** 2 + sd2 ** 2) ** 0.5
+ sd_diff = (sd1**2 + sd2**2) ** 0.5
percent = 100 * av_diff / av1
percent_sd = 100 * sd_diff / av1
print(