summaryrefslogtreecommitdiff
path: root/tests/test_op.py
diff options
context:
space:
mode:
authorNicolas CANIART <nicolas@caniart.net>2021-08-10 10:36:55 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-08-10 12:05:07 -0400
commit1ce816684f213ae50287fb22ce5ff5633257e3d4 (patch)
tree78f2acd24b07b1727e4379ce95acad9c603f86e0 /tests/test_op.py
parent8917b3532da6dabc07187adf597573624b32fe3c (diff)
downloadalembic-1ce816684f213ae50287fb22ce5ff5633257e3d4.tar.gz
Preserve comment and info in Drop/CreateTableOp
Fixed regression due to :ticket:`803` where the ``.info`` and ``.comment`` attributes of ``Table`` would be lost inside of the :class:`.DropTableOp` class, which when "reversed" into a :class:`.CreateTableOp` would then have lost these elements. Pull request courtesy Nicolas CANIART. Fixes: #879 Closes: #881 Pull-request: https://github.com/sqlalchemy/alembic/pull/881 Pull-request-sha: e509b9e8180085998e32746721eeb9266b9f2145 Change-Id: I84a0680266fcf80f3dc922f3cbc76dabd74eedd3
Diffstat (limited to 'tests/test_op.py')
-rw-r--r--tests/test_op.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/test_op.py b/tests/test_op.py
index 3841f25..57da362 100644
--- a/tests/test_op.py
+++ b/tests/test_op.py
@@ -1152,9 +1152,19 @@ class ObjectFromToTest(TestBase):
def test_drop_table(self):
schema_obj = schemaobj.SchemaObjects()
- table = schema_obj.table("x", Column("q", Integer))
+ table = schema_obj.table(
+ "x",
+ Column("q", Integer),
+ info={"custom": "value"},
+ prefixes=["FOREIGN"],
+ postgresql_partition_by="x",
+ comment="some comment",
+ )
op = ops.DropTableOp.from_table(table)
is_not_(op.to_table(), table)
+ eq_(op.to_table().comment, table.comment)
+ eq_(op.to_table().info, table.info)
+ eq_(op.to_table()._prefixes, table._prefixes)
def test_drop_table_add_kw(self):
schema_obj = schemaobj.SchemaObjects()
@@ -1171,9 +1181,19 @@ class ObjectFromToTest(TestBase):
def test_create_table(self):
schema_obj = schemaobj.SchemaObjects()
- table = schema_obj.table("x", Column("q", Integer))
+ table = schema_obj.table(
+ "x",
+ Column("q", Integer),
+ postgresql_partition_by="x",
+ prefixes=["FOREIGN"],
+ info={"custom": "value"},
+ comment="some comment",
+ )
op = ops.CreateTableOp.from_table(table)
is_not_(op.to_table(), table)
+ eq_(op.to_table().comment, table.comment)
+ eq_(op.to_table().info, table.info)
+ eq_(op.to_table()._prefixes, table._prefixes)
def test_create_table_add_kw(self):
schema_obj = schemaobj.SchemaObjects()