Marc Abramowitz  committed f9e04a9

Make MonkeyPatchedBinaryTest not fail on Python 2.5 (which doesn't have
the `b` notation for byte string literals)

  • Participants
  • Parent commits 344f7c8

Comments (0)

Files changed (2)

File lib/sqlalchemy/util/

             return obj
         return g
+# Adapted from
+if py3k:
+    def b(s):
+        return s.encode("latin-1")
+    def b(s):
+        return s

File test/dialect/

 from sqlalchemy.testing import emits_warning_on, assert_raises_message
 import decimal
 from sqlalchemy.engine.reflection import Inspector
+from sqlalchemy.util.compat import b
 class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
     __dialect__ = mssql.dialect()
     def test_bytes(self):
         module = __import__('pymssql')
-        input = b'\x80\x03]q\x00X\x03\x00\x00\x00oneq\x01a.'
+        input = b('\x80\x03]q\x00X\x03\x00\x00\x00oneq\x01a.')
         expected_result = input
         result = module.Binary(input)
         eq_(result, expected_result)