summaryrefslogtreecommitdiff
path: root/tests/test_batch.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-04-27 12:08:28 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-04-27 12:08:28 -0400
commit2681185c17be75dd2749c4439f0e9072c8820acd (patch)
tree3d6a895ea10001a321679f2f6fe233384e8a98d8 /tests/test_batch.py
parent58a170a6c6bfa5d0460c038d63b66d74a5a2c830 (diff)
downloadalembic-2681185c17be75dd2749c4439f0e9072c8820acd.tar.gz
implement table comments for batch
Added missing ``batch_op.create_table_comment()``, ``batch_op.drop_table_comment()`` directives to batch ops. Change-Id: Ia7779619d150a2fe26abb8a8cc89d147a8432f8c Fixes: #799
Diffstat (limited to 'tests/test_batch.py')
-rw-r--r--tests/test_batch.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_batch.py b/tests/test_batch.py
index 23ab364..9e0491d 100644
--- a/tests/test_batch.py
+++ b/tests/test_batch.py
@@ -1703,6 +1703,36 @@ class BatchRoundTripTest(TestBase):
]
)
+ def _assert_table_comment(self, tname, comment):
+ insp = inspect(config.db)
+
+ tcomment = insp.get_table_comment(tname)
+ eq_(tcomment, {"text": comment})
+
+ @config.requirements.comments
+ def test_add_table_comment(self):
+ with self.op.batch_alter_table("foo") as batch_op:
+ batch_op.create_table_comment("some comment")
+
+ self._assert_table_comment("foo", "some comment")
+
+ with self.op.batch_alter_table("foo") as batch_op:
+ batch_op.create_table_comment(
+ "some new comment", existing_comment="some comment"
+ )
+
+ self._assert_table_comment("foo", "some new comment")
+
+ @config.requirements.comments
+ def test_drop_table_comment(self):
+ with self.op.batch_alter_table("foo") as batch_op:
+ batch_op.create_table_comment("some comment")
+
+ with self.op.batch_alter_table("foo") as batch_op:
+ batch_op.drop_table_comment(existing_comment="some comment")
+
+ self._assert_table_comment("foo", None)
+
def _assert_column_comment(self, tname, cname, comment):
insp = inspect(config.db)