summaryrefslogtreecommitdiff
path: root/tests/test_mysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-09 12:24:43 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-09 12:24:43 -0400
commit10d3556a5501563a4110733ecc9d9ba8eb172a99 (patch)
tree0646aa84d3f89c2f9cf59ba298e06d5c1f312ee1 /tests/test_mysql.py
parenteffe3d89238923c5913449879adb1c685eb17c60 (diff)
downloadalembic-10d3556a5501563a4110733ecc9d9ba8eb172a99.tar.gz
- do an autopep8 pass for just about everything other
than line length
Diffstat (limited to 'tests/test_mysql.py')
-rw-r--r--tests/test_mysql.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/tests/test_mysql.py b/tests/test_mysql.py
index 16b171c..1ad1453 100644
--- a/tests/test_mysql.py
+++ b/tests/test_mysql.py
@@ -7,7 +7,9 @@ from . import op_fixture, assert_raises_message, db_for_dialect, \
staging_env, clear_staging_env
from alembic.migration import MigrationContext
+
class MySQLOpTest(TestCase):
+
def test_rename_column(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', new_column_name="c2", existing_type=Integer)
@@ -18,7 +20,7 @@ class MySQLOpTest(TestCase):
def test_rename_column_quotes_needed_one(self):
context = op_fixture('mysql')
op.alter_column('MyTable', 'ColumnOne', new_column_name="ColumnTwo",
- existing_type=Integer)
+ existing_type=Integer)
context.assert_(
'ALTER TABLE `MyTable` CHANGE `ColumnOne` `ColumnTwo` INTEGER NULL'
)
@@ -26,7 +28,7 @@ class MySQLOpTest(TestCase):
def test_rename_column_quotes_needed_two(self):
context = op_fixture('mysql')
op.alter_column('my table', 'column one', new_column_name="column two",
- existing_type=Integer)
+ existing_type=Integer)
context.assert_(
'ALTER TABLE `my table` CHANGE `column one` `column two` INTEGER NULL'
)
@@ -34,7 +36,7 @@ class MySQLOpTest(TestCase):
def test_rename_column_serv_default(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', new_column_name="c2", existing_type=Integer,
- existing_server_default="q")
+ existing_server_default="q")
context.assert_(
"ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL DEFAULT 'q'"
)
@@ -42,7 +44,7 @@ class MySQLOpTest(TestCase):
def test_rename_column_serv_compiled_default(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', existing_type=Integer,
- server_default=func.utc_thing(func.current_timestamp()))
+ server_default=func.utc_thing(func.current_timestamp()))
# this is not a valid MySQL default but the point is to just
# test SQL expression rendering
context.assert_(
@@ -52,7 +54,7 @@ class MySQLOpTest(TestCase):
def test_rename_column_autoincrement(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', new_column_name="c2", existing_type=Integer,
- existing_autoincrement=True)
+ existing_autoincrement=True)
context.assert_(
'ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL AUTO_INCREMENT'
)
@@ -60,7 +62,7 @@ class MySQLOpTest(TestCase):
def test_col_add_autoincrement(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', existing_type=Integer,
- autoincrement=True)
+ autoincrement=True)
context.assert_(
'ALTER TABLE t1 MODIFY c1 INTEGER NULL AUTO_INCREMENT'
)
@@ -68,18 +70,17 @@ class MySQLOpTest(TestCase):
def test_col_remove_autoincrement(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', existing_type=Integer,
- existing_autoincrement=True,
- autoincrement=False)
+ existing_autoincrement=True,
+ autoincrement=False)
context.assert_(
'ALTER TABLE t1 MODIFY c1 INTEGER NULL'
)
-
def test_col_dont_remove_server_default(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', existing_type=Integer,
- existing_server_default='1',
- server_default=False)
+ existing_server_default='1',
+ server_default=False)
context.assert_()
@@ -90,8 +91,6 @@ class MySQLOpTest(TestCase):
'ALTER TABLE t ALTER COLUMN c DROP DEFAULT'
)
-
-
def test_alter_column_modify_default(self):
context = op_fixture('mysql')
# notice we dont need the existing type on this one...
@@ -110,7 +109,7 @@ class MySQLOpTest(TestCase):
def test_col_not_nullable_existing_serv_default(self):
context = op_fixture('mysql')
op.alter_column('t1', 'c1', nullable=False, existing_type=Integer,
- existing_server_default='5')
+ existing_server_default='5')
context.assert_(
"ALTER TABLE t1 MODIFY c1 INTEGER NOT NULL DEFAULT '5'"
)
@@ -191,7 +190,9 @@ class MySQLOpTest(TestCase):
op.drop_constraint, "f1", "t1"
)
+
class MySQLDefaultCompareTest(TestCase):
+
@classmethod
def setup_class(cls):
cls.bind = db_for_dialect("mysql")
@@ -209,7 +210,7 @@ class MySQLDefaultCompareTest(TestCase):
'connection': connection,
'dialect': connection.dialect,
'context': context
- }
+ }
@classmethod
def teardown_class(cls):
@@ -228,11 +229,11 @@ class MySQLDefaultCompareTest(TestCase):
alternate = txt
expected = False
t = Table("test", self.metadata,
- Column("somecol", type_, server_default=text(txt) if txt else None)
- )
+ Column("somecol", type_, server_default=text(txt) if txt else None)
+ )
t2 = Table("test", MetaData(),
- Column("somecol", type_, server_default=text(alternate))
- )
+ Column("somecol", type_, server_default=text(alternate))
+ )
assert self._compare_default(
t, t2, t2.c.somecol, alternate
) is expected
@@ -263,4 +264,3 @@ class MySQLDefaultCompareTest(TestCase):
TIMESTAMP(),
None, "CURRENT_TIMESTAMP",
)
-