summaryrefslogtreecommitdiff
path: root/tests/test_mssql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-09 16:51:29 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-09 16:51:29 -0400
commita2cd65bca9c4e802bdb04d9b254efb07eea8bebc (patch)
tree177b588688851955f234bf9e7cf3923a03e475a7 /tests/test_mssql.py
parentead05ce48d40d4235b2395972fd1a6efb96d414c (diff)
downloadalembic-a2cd65bca9c4e802bdb04d9b254efb07eea8bebc.tar.gz
- finish flake8 on tests
Diffstat (limited to 'tests/test_mssql.py')
-rw-r--r--tests/test_mssql.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/tests/test_mssql.py b/tests/test_mssql.py
index 396692f..92a9546 100644
--- a/tests/test_mssql.py
+++ b/tests/test_mssql.py
@@ -7,7 +7,7 @@ from sqlalchemy import Integer, Column
from alembic import op, command, util
from . import op_fixture, capture_context_buffer, \
_no_sql_testing_config, assert_raises_message, staging_env, \
- three_rev_fixture, clear_staging_env
+ three_rev_fixture, clear_staging_env, eq_
class FullEnvironmentTests(TestCase):
@@ -30,7 +30,10 @@ class FullEnvironmentTests(TestCase):
assert "BEGIN TRANSACTION;" in buf.getvalue()
# ensure ends in COMMIT; GO
- assert [x for x in buf.getvalue().splitlines() if x][-2:] == ['COMMIT;', 'GO']
+ eq_(
+ [x for x in buf.getvalue().splitlines() if x][-2:],
+ ['COMMIT;', 'GO']
+ )
def test_batch_separator_default(self):
with capture_context_buffer() as buf:
@@ -52,7 +55,8 @@ class OpTest(TestCase):
def test_add_column_with_default(self):
context = op_fixture("mssql")
- op.add_column('t1', Column('c1', Integer, nullable=False, server_default="12"))
+ op.add_column(
+ 't1', Column('c1', Integer, nullable=False, server_default="12"))
context.assert_("ALTER TABLE t1 ADD c1 INTEGER NOT NULL DEFAULT '12'")
def test_alter_column_rename_mssql(self):
@@ -94,13 +98,15 @@ class OpTest(TestCase):
context = op_fixture('mssql')
op.drop_column('t1', 'c1', mssql_drop_default=True)
op.drop_column('t1', 'c2', mssql_drop_default=True)
- context.assert_contains("exec('alter table t1 drop constraint ' + @const_name)")
+ context.assert_contains(
+ "exec('alter table t1 drop constraint ' + @const_name)")
context.assert_contains("ALTER TABLE t1 DROP COLUMN c1")
def test_alter_column_drop_default(self):
context = op_fixture('mssql')
op.alter_column("t", "c", server_default=None)
- context.assert_contains("exec('alter table t drop constraint ' + @const_name)")
+ context.assert_contains(
+ "exec('alter table t drop constraint ' + @const_name)")
def test_alter_column_dont_drop_default(self):
context = op_fixture('mssql')
@@ -111,13 +117,15 @@ class OpTest(TestCase):
context = op_fixture('mssql')
op.drop_column('t1', 'c1', mssql_drop_check=True)
op.drop_column('t1', 'c2', mssql_drop_check=True)
- context.assert_contains("exec('alter table t1 drop constraint ' + @const_name)")
+ context.assert_contains(
+ "exec('alter table t1 drop constraint ' + @const_name)")
context.assert_contains("ALTER TABLE t1 DROP COLUMN c1")
def test_drop_column_w_check_quoting(self):
context = op_fixture('mssql')
op.drop_column('table', 'column', mssql_drop_check=True)
- context.assert_contains("exec('alter table [table] drop constraint ' + @const_name)")
+ context.assert_contains(
+ "exec('alter table [table] drop constraint ' + @const_name)")
context.assert_contains("ALTER TABLE [table] DROP COLUMN [column]")
def test_alter_column_nullable_w_existing_type(self):
@@ -130,7 +138,8 @@ class OpTest(TestCase):
def test_drop_column_w_fk(self):
context = op_fixture('mssql')
op.drop_column('t1', 'c1', mssql_drop_foreign_key=True)
- context.assert_contains("exec('alter table t1 drop constraint ' + @const_name)")
+ context.assert_contains(
+ "exec('alter table t1 drop constraint ' + @const_name)")
context.assert_contains("ALTER TABLE t1 DROP COLUMN c1")
def test_alter_column_not_nullable_w_existing_type(self):
@@ -173,8 +182,10 @@ class OpTest(TestCase):
def test_alter_replace_server_default(self):
context = op_fixture('mssql')
- op.alter_column("t", "c", server_default="5", existing_server_default="6")
- context.assert_contains("exec('alter table t drop constraint ' + @const_name)")
+ op.alter_column(
+ "t", "c", server_default="5", existing_server_default="6")
+ context.assert_contains(
+ "exec('alter table t drop constraint ' + @const_name)")
context.assert_contains(
"ALTER TABLE t ADD DEFAULT '5' FOR c"
)
@@ -182,7 +193,8 @@ class OpTest(TestCase):
def test_alter_remove_server_default(self):
context = op_fixture('mssql')
op.alter_column("t", "c", server_default=None)
- context.assert_contains("exec('alter table t drop constraint ' + @const_name)")
+ context.assert_contains(
+ "exec('alter table t drop constraint ' + @const_name)")
def test_alter_do_everything(self):
context = op_fixture('mssql')