summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-11-29 19:21:58 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-11-29 19:21:58 -0500
commit2f55f3a54319ab144a0d98287bf8b7755d7282a4 (patch)
tree93f442ac0df6f3bdbf75224a06d0a3ab9a2c2448 /tests
parenta0f0cd381dc5bb4b780fa239df277891b2236e34 (diff)
downloadalembic-2f55f3a54319ab144a0d98287bf8b7755d7282a4.tar.gz
- add alter col default for PG/base
- i want the ; after BEGIN/COMMIT for static generation, makes it easier to parse
Diffstat (limited to 'tests')
-rw-r--r--tests/test_mssql.py4
-rw-r--r--tests/test_op.py22
-rw-r--r--tests/test_sql_script.py8
3 files changed, 28 insertions, 6 deletions
diff --git a/tests/test_mssql.py b/tests/test_mssql.py
index 883590f..bdf8272 100644
--- a/tests/test_mssql.py
+++ b/tests/test_mssql.py
@@ -26,8 +26,8 @@ class FullEnvironmentTests(TestCase):
def test_begin_comit(self):
with capture_context_buffer(transactional_ddl=True) as buf:
command.upgrade(self.cfg, self.a, sql=True)
- assert "BEGIN TRANSACTION" in buf.getvalue()
- assert "COMMIT" in buf.getvalue()
+ assert "BEGIN TRANSACTION;" in buf.getvalue()
+ assert "COMMIT;" in buf.getvalue()
def test_batch_separator_default(self):
with capture_context_buffer() as buf:
diff --git a/tests/test_op.py b/tests/test_op.py
index d69ec44..bc20d80 100644
--- a/tests/test_op.py
+++ b/tests/test_op.py
@@ -98,6 +98,28 @@ def test_alter_column_type():
'ALTER TABLE t ALTER COLUMN c TYPE VARCHAR(50)'
)
+def test_alter_column_set_default():
+ context = op_fixture()
+ op.alter_column("t", "c", server_default="q")
+ context.assert_(
+ "ALTER TABLE t ALTER COLUMN c SET DEFAULT 'q'"
+ )
+
+def test_alter_column_set_compiled_default():
+ context = op_fixture()
+ op.alter_column("t", "c", server_default=func.utc_thing(func.current_timestamp()))
+ context.assert_(
+ "ALTER TABLE t ALTER COLUMN c SET DEFAULT utc_thing(CURRENT_TIMESTAMP)"
+ )
+
+def test_alter_column_drop_default():
+ context = op_fixture()
+ op.alter_column("t", "c", server_default=None)
+ context.assert_(
+ 'ALTER TABLE t ALTER COLUMN c DROP DEFAULT'
+ )
+
+
def test_alter_column_schema_type_unnamed():
context = op_fixture('mssql')
op.alter_column("t", "c", type_=Boolean())
diff --git a/tests/test_sql_script.py b/tests/test_sql_script.py
index a615bdf..e127cb7 100644
--- a/tests/test_sql_script.py
+++ b/tests/test_sql_script.py
@@ -17,13 +17,13 @@ def teardown():
def test_begin_comit():
with capture_context_buffer(transactional_ddl=True) as buf:
command.upgrade(cfg, a, sql=True)
- assert "BEGIN" in buf.getvalue()
- assert "COMMIT" in buf.getvalue()
+ assert "BEGIN;" in buf.getvalue()
+ assert "COMMIT;" in buf.getvalue()
with capture_context_buffer(transactional_ddl=False) as buf:
command.upgrade(cfg, a, sql=True)
- assert "BEGIN" not in buf.getvalue()
- assert "COMMIT" not in buf.getvalue()
+ assert "BEGIN;" not in buf.getvalue()
+ assert "COMMIT;" not in buf.getvalue()
def test_version_from_none_insert():
with capture_context_buffer() as buf: