[Python-3000-checkins] r57648 - python/branches/py3k/Lib/bsddb/test/test_compare.py

gregory.p.smith python-3000-checkins at python.org
Wed Aug 29 07:06:13 CEST 2007


Author: gregory.p.smith
Date: Wed Aug 29 07:06:13 2007
New Revision: 57648

Modified:
   python/branches/py3k/Lib/bsddb/test/test_compare.py
Log:
strings vs bytes, bytes wins again


Modified: python/branches/py3k/Lib/bsddb/test/test_compare.py
==============================================================================
--- python/branches/py3k/Lib/bsddb/test/test_compare.py	(original)
+++ python/branches/py3k/Lib/bsddb/test/test_compare.py	Wed Aug 29 07:06:13 2007
@@ -26,9 +26,9 @@
         return - delegate (left, right)
     return reverse
 
-_expected_lexical_test_data = [bytes(_) for _ in
+_expected_lexical_test_data = [s.encode('ascii') for s in
         ('', 'CCCP', 'a', 'aaa', 'b', 'c', 'cccce', 'ccccf')]
-_expected_lowercase_test_data = [bytes(_) for _ in
+_expected_lowercase_test_data = [s.encode('ascii') for s in
         ('', 'a', 'aaa', 'b', 'c', 'CC', 'cccce', 'ccccf', 'CCCP')]
 
 class ComparatorTests (unittest.TestCase):
@@ -73,7 +73,7 @@
     def addDataToDB (self, data):
         i = 0
         for item in data:
-            self.db.put (item, str (i))
+            self.db.put (item, str(i).encode("ascii"))
             i = i + 1
 
     def createDB (self, key_comparator):
@@ -181,7 +181,7 @@
             sys.stderr = stdErr
             errorOut = temp.getvalue()
             if not successRe.search(errorOut):
-                self.fail("unexpected stderr output:\n"+errorOut)
+                self.fail("unexpected stderr output: %r" % errorOut)
 
     def _test_compare_function_exception (self):
         self.startTest ()


More information about the Python-3000-checkins mailing list