mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-23 05:00:07 +00: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:
parent
9735453283
commit
bc71bf7acd
@ -13,7 +13,7 @@ version = sys.version[0:3]
|
||||
vers = sys.version_info[:2]
|
||||
if sys.argv[1] in ("--run", "-r"):
|
||||
suffix = "_run"
|
||||
assert sys.argv >= 3
|
||||
assert len(sys.argv) >= 3
|
||||
py_source = sys.argv[2:]
|
||||
i = 2
|
||||
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
|
||||
|
||||
# RUNNABLE!
|
||||
"""This program is self-checking!"""
|
||||
|
||||
def assertCloseAbs(x, y, eps=1e-09):
|
||||
"""Return true iff floats x and y "are close\""""
|
||||
if abs(x) > abs(y):
|
||||
@ -32,7 +34,7 @@ def check_div(x, y):
|
||||
assertClose(q, x)
|
||||
|
||||
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]
|
||||
for x 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)
|
||||
z1, z2 = (0j, -0j)
|
||||
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.
|
||||
# And put it in a tuple and a list to make it harder.
|
||||
|
Loading…
Reference in New Issue
Block a user