]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added a test for #1085
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 30 Sep 2009 20:55:00 +0000 (20:55 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 30 Sep 2009 20:55:00 +0000 (20:55 +0000)
lib/sqlalchemy/test/testing.py
test/dialect/test_postgresql.py

index 317e3946be3be353fe01d1cde7d3f3bce96d75cb..654153adbabc1a89b3c819b7c4d9e0e12f8813ca 100644 (file)
@@ -630,14 +630,18 @@ class AssertsCompiledSQL(object):
             eq_(c.construct_params(params), checkparams)
 
 class ComparesTables(object):
-    def assert_tables_equal(self, table, reflected_table):
+    def assert_tables_equal(self, table, reflected_table, strict_types=False):
         assert len(table.c) == len(reflected_table.c)
         for c, reflected_c in zip(table.c, reflected_table.c):
             eq_(c.name, reflected_c.name)
             assert reflected_c is reflected_table.c[c.name]
             eq_(c.primary_key, reflected_c.primary_key)
             eq_(c.nullable, reflected_c.nullable)
-            self.assert_types_base(reflected_c, c)
+            
+            if strict_types:
+                assert type(reflected_c.type) is type(c.type), "Type '%s' doesn't correspond to type '%s'" % (reflected_c.type, c.type)
+            else:
+                self.assert_types_base(reflected_c, c)
 
             if isinstance(c.type, sqltypes.String):
                 eq_(c.type.length, reflected_c.type.length)
index c27e24e43afdb004becc2acf24f040786dd9c185..3fa12c5dd4c8541cf67fcd6961e94b118efc6415 100644 (file)
@@ -1156,7 +1156,9 @@ class SpecialTypesTest(TestBase, ComparesTables):
             Column('flag', postgresql.PGBit),
             Column('addr', postgresql.PGInet),
             Column('addr2', postgresql.PGMacAddr),
-            Column('addr3', postgresql.PGCidr)
+            Column('addr3', postgresql.PGCidr),
+            Column('doubleprec', postgresql.DOUBLE_PRECISION)
+            
         )
         
         metadata.create_all()
@@ -1169,7 +1171,7 @@ class SpecialTypesTest(TestBase, ComparesTables):
         m = MetaData(testing.db)
         t = Table('sometable', m, autoload=True)
         
-        self.assert_tables_equal(table, t)
+        self.assert_tables_equal(table, t, strict_types=True)
         
 
 class MatchTest(TestBase, AssertsCompiledSQL):