From: Mike Bayer Date: Wed, 30 Sep 2009 20:55:00 +0000 (+0000) Subject: added a test for #1085 X-Git-Tag: rel_0_6beta1~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d8ba830467f065b5778f4b119dbd3a3c276a845;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git added a test for #1085 --- diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py index 317e3946be..654153adba 100644 --- a/lib/sqlalchemy/test/testing.py +++ b/lib/sqlalchemy/test/testing.py @@ -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) diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index c27e24e43a..3fa12c5dd4 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -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):