You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Shorten 10_complex.py
Runtime testing took too long because ranges were larger than needed Also use newer convention for marking runable codes
This commit is contained in:
@@ -13,7 +13,7 @@ version = sys.version[0:3]
|
|||||||
vers = sys.version_info[:2]
|
vers = sys.version_info[:2]
|
||||||
if sys.argv[1] in ("--run", "-r"):
|
if sys.argv[1] in ("--run", "-r"):
|
||||||
suffix = "_run"
|
suffix = "_run"
|
||||||
assert sys.argv >= 3
|
assert len(sys.argv) >= 3
|
||||||
py_source = sys.argv[2:]
|
py_source = sys.argv[2:]
|
||||||
i = 2
|
i = 2
|
||||||
else:
|
else:
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,6 +2,8 @@
|
|||||||
from math import atan2
|
from math import atan2
|
||||||
|
|
||||||
# RUNNABLE!
|
# RUNNABLE!
|
||||||
|
"""This program is self-checking!"""
|
||||||
|
|
||||||
def assertCloseAbs(x, y, eps=1e-09):
|
def assertCloseAbs(x, y, eps=1e-09):
|
||||||
"""Return true iff floats x and y "are close\""""
|
"""Return true iff floats x and y "are close\""""
|
||||||
if abs(x) > abs(y):
|
if abs(x) > abs(y):
|
||||||
@@ -32,7 +34,7 @@ def check_div(x, y):
|
|||||||
assertClose(q, x)
|
assertClose(q, x)
|
||||||
|
|
||||||
def test_truediv():
|
def test_truediv():
|
||||||
simple_real = [float(i) for i in range(-5, 6)]
|
simple_real = [float(i) for i in range(-3, 3)]
|
||||||
simple_complex = [complex(x, y) for x in simple_real for y in simple_real]
|
simple_complex = [complex(x, y) for x in simple_real for y in simple_real]
|
||||||
for x in simple_complex:
|
for x in simple_complex:
|
||||||
for y in simple_complex:
|
for y in simple_complex:
|
||||||
@@ -43,7 +45,7 @@ def test_plus_minus_0j():
|
|||||||
assert -0-0j == -0j == complex(0.0, 0.0)
|
assert -0-0j == -0j == complex(0.0, 0.0)
|
||||||
z1, z2 = (0j, -0j)
|
z1, z2 = (0j, -0j)
|
||||||
assert atan2(z1.imag, -1.0) == atan2(0.0, -1.0)
|
assert atan2(z1.imag, -1.0) == atan2(0.0, -1.0)
|
||||||
# assert atan2(z2.imag, -1.0), atan2(-0.0, -1.0)
|
assert atan2(z2.imag, -1.0), atan2(-0.0, -1.0)
|
||||||
|
|
||||||
# Check that we can handle -inf, and inf as a complex numbers.
|
# Check that we can handle -inf, and inf as a complex numbers.
|
||||||
# And put it in a tuple and a list to make it harder.
|
# And put it in a tuple and a list to make it harder.
|
||||||
|
Reference in New Issue
Block a user