Commits

Marc Abramowitz committed f9e04a9

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

Comments (0)

Files changed (2)

lib/sqlalchemy/util/compat.py

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

test/dialect/test_mssql.py

 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)