From eb0a8ca8ecf9e2c7449b15915244b36e857c740f Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 26 Nov 2013 18:48:11 -0500 Subject: [PATCH] cleanup --- tests/test_postgresql.py | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index 9c530353..c680c0e6 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -2,6 +2,8 @@ from unittest import TestCase from sqlalchemy import DateTime, MetaData, Table, Column, text, Integer, String from sqlalchemy.engine.reflection import Inspector +from alembic.operations import Operations +from sqlalchemy.sql import table, column from alembic import command, util from alembic.migration import MigrationContext @@ -13,7 +15,7 @@ from . import db_for_dialect, eq_, staging_env, \ class PGOfflineEnumTest(TestCase): @requires_07 def setUp(self): - env = staging_env() + staging_env() self.cfg = cfg = _no_sql_testing_config() self.rid = rid = util.rev_id() @@ -94,9 +96,6 @@ def downgrade(): assert "DROP TABLE sometable" in buf.getvalue() assert "DROP TYPE pgenum" in buf.getvalue() -from alembic.migration import MigrationContext -from alembic.operations import Operations -from sqlalchemy.sql import table, column class PostgresqlInlineLiteralTest(TestCase): @classmethod @@ -133,7 +132,7 @@ class PostgresqlInlineLiteralTest(TestCase): tab.update().where( tab.c.col.like(self.op.inline_literal('%.%')) ).values(col=self.op.inline_literal('new data')), - execution_options={'no_parameters':True} + execution_options={'no_parameters': True} ) eq_( self.conn.execute("select count(*) from tab where col='new data'").scalar(), @@ -146,18 +145,18 @@ class PostgresqlDefaultCompareTest(TestCase): cls.bind = db_for_dialect("postgresql") staging_env() context = MigrationContext.configure( - connection = cls.bind.connect(), - opts = { - 'compare_type':True, - 'compare_server_default':True + connection=cls.bind.connect(), + opts={ + 'compare_type': True, + 'compare_server_default': True } ) connection = context.bind cls.autogen_context = { - 'imports':set(), - 'connection':connection, - 'dialect':connection.dialect, - 'context':context + 'imports': set(), + 'connection': connection, + 'dialect': connection.dialect, + 'context': context } @classmethod @@ -170,8 +169,7 @@ class PostgresqlDefaultCompareTest(TestCase): def tearDown(self): self.metadata.drop_all() - def _compare_default_roundtrip( - self, type_, txt, alternate=None): + def _compare_default_roundtrip(self, type_, txt, alternate=None): if alternate: expected = True else: @@ -208,12 +206,6 @@ class PostgresqlDefaultCompareTest(TestCase): "TIMEZONE('utc', CURRENT_TIMESTAMP)", ) - def test_compare_current_timestamp(self): - self._compare_default_roundtrip( - DateTime(), - "TIMEZONE('utc', CURRENT_TIMESTAMP)", - ) - def test_compare_integer(self): self._compare_default_roundtrip( Integer(), -- 2.47.2