in tutorials/ComplexArithmetic/testing.py [0:0]
def complex_div_test(fun):
for i in range(25):
x = prep_random_cartesian()
y = (0, 0)
while y == (0, 0):
y = prep_random_cartesian()
expected = complex_div_ref(x, y)
actual = fun(x, y)
msg = assert_tuple(actual)
if msg != None:
print(msg)
return
msg = assert_cartesian(expected, actual,
"Quotient doesn't seem to match expected value: expected ("
+ format_cartesian(x)
+ ") / ("
+ format_cartesian(y)
+ ") = "
+ format_cartesian(expected)
+ ", got "
+ format_cartesian(actual))
if msg != None:
print(msg)
return
print("Success!")