]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix test, use bytes not unicode and let the test raise its internal exception
authorGregory P. Smith <greg@mad-scientist.com>
Mon, 3 Sep 2007 16:48:32 +0000 (16:48 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Mon, 3 Sep 2007 16:48:32 +0000 (16:48 +0000)
rather than just complaining about stderr not being what we expected masking
the true problem.

Lib/bsddb/test/test_compare.py

index 0a575906c0f296bc128f4c6ef646c97e415e1e00..f823a75698899f474222f5db78cdf1542c79468b 100644 (file)
@@ -179,9 +179,9 @@ class BtreeExceptionsTestCase (AbstractBtreeKeyCompareTestCase):
         finally:
             temp = sys.stderr
             sys.stderr = stdErr
-            errorOut = temp.getvalue()
-            if not successRe.search(errorOut):
-                self.fail("unexpected stderr output: %r" % errorOut)
+        errorOut = temp.getvalue()
+        if not successRe.search(errorOut):
+            self.fail("unexpected stderr output: %r" % errorOut)
 
     def _test_compare_function_exception (self):
         self.startTest ()
@@ -192,7 +192,7 @@ class BtreeExceptionsTestCase (AbstractBtreeKeyCompareTestCase):
             raise RuntimeError("i'm a naughty comparison function")
         self.createDB (bad_comparator)
         #print "\n*** test should print 2 uncatchable tracebacks ***"
-        self.addDataToDB (['a', 'b', 'c'])  # this should raise, but...
+        self.addDataToDB ([b'a', b'b', b'c'])  # this should raise, but...
         self.finishTest ()
 
     def test_compare_function_exception(self):
@@ -210,7 +210,7 @@ class BtreeExceptionsTestCase (AbstractBtreeKeyCompareTestCase):
             return l
         self.createDB (bad_comparator)
         #print "\n*** test should print 2 errors about returning an int ***"
-        self.addDataToDB (['a', 'b', 'c'])  # this should raise, but...
+        self.addDataToDB ([b'a', b'b', b'c'])  # this should raise, but...
         self.finishTest ()
 
     def test_compare_function_bad_return(self):