test_complex: repair new test's usage of vereq().
if complex(0.0, 0.0):
raise TestFailed("complex(0.0, 0.0) should be false")
-if vereq(complex(5.3, 9.8).conjugate(), 5.3-9.8j):
- raise TestFailed("complex.conjugate() didn't work")
+vereq(complex(5.3, 9.8).conjugate(), 5.3-9.8j)
try:
print int(5+3j)
raise TestFailed(reason)
def vereq(a, b):
+ """Raise TestFailed if a == b is false.
+
+ This is better than verify(a == b) because, in case of failure, the
+ error message incorporates repr(a) and repr(b) so you can see the
+ inputs.
+
+ Note that "not (a == b)" isn't necessarily the same as "a != b"; the
+ former is tested.
+ """
+
if not (a == b):
raise TestFailed, "%r == %r" % (a, b)