diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-07 10:22:08 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-02-07 10:22:08 -0500 |
commit | a14729266a8b3c9b491c41bc1fe1cb03ccad51af (patch) | |
tree | ee06fa105318ba540c5c6ccd8b8c13424c042026 | |
parent | 68900c2654a6918de2c4e264cd197da953f0ed11 (diff) | |
download | sqlalchemy-a14729266a8b3c9b491c41bc1fe1cb03ccad51af.tar.gz |
- make even more tables
-rw-r--r-- | test/dialect/mysql/test_reflection.py | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/test/dialect/mysql/test_reflection.py b/test/dialect/mysql/test_reflection.py index 909ebd5e5..39b39e006 100644 --- a/test/dialect/mysql/test_reflection.py +++ b/test/dialect/mysql/test_reflection.py @@ -293,36 +293,39 @@ class ReflectionTest(fixtures.TestBase, AssertsExecutionResults): # this is ideally one table, but older MySQL versions choke # on the multiple TIMESTAMP columns - Table('nn_t1', meta) # to allow DROP - Table('nn_t2', meta) - Table('nn_t3', meta) - - testing.db.execute(""" - CREATE TABLE nn_t1 ( - x INTEGER NULL, - y INTEGER NOT NULL, - z INTEGER, - q TIMESTAMP NULL, - p TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP)""") - - testing.db.execute(""" - CREATE TABLE nn_t2 ( - r TIMESTAMP NOT NULL, - s TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP)""") - - testing.db.execute(""" - CREATE TABLE nn_t3 ( - t TIMESTAMP, - u TIMESTAMP DEFAULT CURRENT_TIMESTAMP - )""") - eq_( + reflected = [] + for idx, cols in enumerate([ [ - {"name": d['name'], "nullable": d['nullable'], - "default": d['default']} - for d in sum([inspect(testing.db).get_columns(t) - for t in ('nn_t1', 'nn_t2', 'nn_t3')], []) + "x INTEGER NULL", + "y INTEGER NOT NULL", + "z INTEGER", + "q TIMESTAMP NULL" ], + + ["p TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"], + ["r TIMESTAMP NOT NULL"], + ["s TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"], + ["t TIMESTAMP"], + ["u TIMESTAMP DEFAULT CURRENT_TIMESTAMP"] + ]): + Table("nn_t%d" % idx, meta) # to allow DROP + + testing.db.execute(""" + CREATE TABLE nn_t%d ( + %s + ) + """ % (idx, ", \n".join(cols))) + + reflected.extend( + { + "name": d['name'], "nullable": d['nullable'], + "default": d['default']} + for d in inspect(testing.db).get_columns("nn_t%d" % idx) + ) + + eq_( + reflected, [ {'name': 'x', 'nullable': True, 'default': None}, {'name': 'y', 'nullable': False, 'default': None}, |