diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2020-12-03 17:39:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-12-03 17:39:43 +0000 |
commit | d22fa3c86fc317aba7dbff20a933a0805baa0cad (patch) | |
tree | 60ee4c22c5d3775253d1af7517a6c501aa3ede17 /test/dialect/mysql/test_reflection.py | |
parent | 1a3def008ec84e8caa49461ae947ed00078f72ae (diff) | |
parent | 7fb41cfc69c6521bebce229a56bddd6267f39955 (diff) | |
download | sqlalchemy-d22fa3c86fc317aba7dbff20a933a0805baa0cad.tar.gz |
Merge "Reflect decimal points in MariaDB non-quoted numeric defaults"
Diffstat (limited to 'test/dialect/mysql/test_reflection.py')
-rw-r--r-- | test/dialect/mysql/test_reflection.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/dialect/mysql/test_reflection.py b/test/dialect/mysql/test_reflection.py index d5684b22f..3871dbecc 100644 --- a/test/dialect/mysql/test_reflection.py +++ b/test/dialect/mysql/test_reflection.py @@ -234,6 +234,9 @@ class ReflectionTest(fixtures.TestBase, AssertsCompiledSQL): def test_default_reflection(self): """Test reflection of column defaults.""" + # TODO: this test is a mess. should be broken into individual + # combinations + from sqlalchemy.dialects.mysql import VARCHAR def_table = Table( @@ -258,6 +261,8 @@ class ReflectionTest(fixtures.TestBase, AssertsCompiledSQL): ) ), ), + Column("c7", mysql.DOUBLE(), DefaultClause("0.0000")), + Column("c8", mysql.DOUBLE(22, 6), DefaultClause("0.0000")), ) def_table.create(testing.db) @@ -280,6 +285,15 @@ class ReflectionTest(fixtures.TestBase, AssertsCompiledSQL): assert reflected.c.c5.default is None assert reflected.c.c5.server_default is None assert reflected.c.c6.default is None + assert str(reflected.c.c7.server_default.arg) in ("0", "'0'") + + # this is because the numeric is 6 decimal places, MySQL + # formats it to that many places. + assert str(reflected.c.c8.server_default.arg) in ( + "0.000000", + "'0.000000'", + ) + assert re.match( r"CURRENT_TIMESTAMP(\(\))? ON UPDATE CURRENT_TIMESTAMP(\(\))?", str(reflected.c.c6.server_default.arg).upper(), @@ -300,6 +314,11 @@ class ReflectionTest(fixtures.TestBase, AssertsCompiledSQL): assert reflected.c.c5.default is None assert reflected.c.c5.server_default is None assert reflected.c.c6.default is None + assert str(reflected.c.c7.server_default.arg) in ("0", "'0'") + assert str(reflected.c.c8.server_default.arg) in ( + "0.000000", + "'0.000000'", + ) assert re.match( r"CURRENT_TIMESTAMP(\(\))? ON UPDATE CURRENT_TIMESTAMP(\(\))?", str(reflected.c.c6.server_default.arg).upper(), |