]> granicus.if.org Git - python/commitdiff
test_support: add a docstring to vereq().
authorTim Peters <tim.peters@gmail.com>
Sat, 29 Dec 2001 17:34:57 +0000 (17:34 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 29 Dec 2001 17:34:57 +0000 (17:34 +0000)
test_complex:  repair new test's usage of vereq().

Lib/test/test_complex.py
Lib/test/test_support.py

index 1fa0ee0e7e19a99dd8940c9405c860171d44c0c1..ff7bb14335db4b5cdc4eba552dc6c9553b16efb6 100644 (file)
@@ -63,8 +63,7 @@ for i in range(100):
 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)
index 83bde3ee9f91c8caf9de87311f1cd69bf1366cd1..4a456179b7e2ad7cce22616ea6e27aa290d58baa 100644 (file)
@@ -118,6 +118,16 @@ def verify(condition, reason='test failed'):
         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)