]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added in MSGenericBinary to the mssql dialect tests.
authorMichael Trier <mtrier@gmail.com>
Mon, 29 Dec 2008 21:38:04 +0000 (21:38 +0000)
committerMichael Trier <mtrier@gmail.com>
Mon, 29 Dec 2008 21:38:04 +0000 (21:38 +0000)
test/dialect/mssql.py

index f63787e7484f0a203e4f8026fdee0810ef2f5f9f..babb493ac6e8666bd1d6de0981b19b04ade6540d 100755 (executable)
@@ -555,8 +555,13 @@ class TypesTest2(TestBase, AssertsExecutionResults):
              'VARBINARY(10)'),
 
             (mssql.MSImage, [], {},
-             'IMAGE')
-           ]
+             'IMAGE'),
+
+            (types.Binary, [], {},
+             'IMAGE'),
+            (types.Binary, [10], {},
+             'BINARY(10)')
+            ]
 
         table_args = ['test_mssql_binary', MetaData(testing.db)]
         for index, spec in enumerate(columns):
@@ -580,7 +585,11 @@ class TypesTest2(TestBase, AssertsExecutionResults):
 
         reflected_binary = Table('test_mssql_binary', MetaData(testing.db), autoload=True)
         for col in reflected_binary.c:
-            testing.eq_(col.type.__class__, binary_table.c[col.name].type.__class__)
+            # don't test the MSGenericBinary since it's a special case and
+            # reflected it will map to a MSImage or MSBinary depending
+            if not testing.db.dialect.type_descriptor(binary_table.c[col.name].type).__class__ == mssql.MSGenericBinary:
+                testing.eq_(testing.db.dialect.type_descriptor(col.type).__class__,
+                    testing.db.dialect.type_descriptor(binary_table.c[col.name].type).__class__)
             if binary_table.c[col.name].type.length:
                 testing.eq_(col.type.length, binary_table.c[col.name].type.length)
         binary_table.drop()
@@ -864,7 +873,7 @@ class BinaryTest(TestBase, AssertsExecutionResults):
     def tearDownAll(self):
         binary_table.drop()
 
-    def testbinary(self):
+    def test_binary(self):
         testobj1 = pickleable.Foo('im foo 1')
         testobj2 = pickleable.Foo('im foo 2')
         testobj3 = pickleable.Foo('im foo 3')