summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-05-30 11:31:03 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-06-20 13:50:41 -0400
commit190e0139e834e4271268652e058c280787ae69eb (patch)
tree21e93907a58cd2f390f687ddc5e0c1da1eb25454 /test/dialect/postgresql
parentff8e7732b9f656f8cea05544660c18d57dd37864 (diff)
downloadsqlalchemy-190e0139e834e4271268652e058c280787ae69eb.tar.gz
Enable F841
This is a very useful assertion which prevents unused variables from being set up allows code to be more readable and sometimes even more efficient. test suites seem to be where the most problems are and there do not seem to be documentation examples that are using this, or at least the linter is not taking effect within rst blocks. Change-Id: I2b3341d8dd14da34879d8425838e66a4b9f8e27d
Diffstat (limited to 'test/dialect/postgresql')
-rw-r--r--test/dialect/postgresql/test_reflection.py20
-rw-r--r--test/dialect/postgresql/test_types.py14
2 files changed, 16 insertions, 18 deletions
diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py
index 9580018be..7e7a82d46 100644
--- a/test/dialect/postgresql/test_reflection.py
+++ b/test/dialect/postgresql/test_reflection.py
@@ -49,7 +49,7 @@ class ForeignTableReflectionTest(fixtures.TablesTest, AssertsExecutionResults):
"sqla_testing", "postgres_test_db_link"
)
- testtable = Table(
+ Table(
"testtable",
metadata,
Column("id", Integer, primary_key=True),
@@ -86,13 +86,13 @@ class ForeignTableReflectionTest(fixtures.TablesTest, AssertsExecutionResults):
def test_get_foreign_table_names(self):
inspector = inspect(testing.db)
- with testing.db.connect() as conn:
+ with testing.db.connect():
ft_names = inspector.get_foreign_table_names()
eq_(ft_names, ["test_foreigntable"])
def test_get_table_names_no_foreign(self):
inspector = inspect(testing.db)
- with testing.db.connect() as conn:
+ with testing.db.connect():
names = inspector.get_table_names()
eq_(names, ["testtable"])
@@ -450,7 +450,7 @@ class ReflectionTest(fixtures.TestBase):
@testing.provide_metadata
def test_renamed_sequence_reflection(self):
metadata = self.metadata
- t = Table("t", metadata, Column("id", Integer, primary_key=True))
+ Table("t", metadata, Column("id", Integer, primary_key=True))
metadata.create_all()
m2 = MetaData(testing.db)
t2 = Table("t", m2, autoload=True, implicit_returning=False)
@@ -472,7 +472,7 @@ class ReflectionTest(fixtures.TestBase):
@testing.provide_metadata
def test_altered_type_autoincrement_pk_reflection(self):
metadata = self.metadata
- t = Table(
+ Table(
"t",
metadata,
Column("id", Integer, primary_key=True),
@@ -490,7 +490,7 @@ class ReflectionTest(fixtures.TestBase):
@testing.provide_metadata
def test_renamed_pk_reflection(self):
metadata = self.metadata
- t = Table("t", metadata, Column("id", Integer, primary_key=True))
+ Table("t", metadata, Column("id", Integer, primary_key=True))
metadata.create_all()
testing.db.connect().execution_options(autocommit=True).execute(
"alter table t rename id to t_id"
@@ -705,9 +705,7 @@ class ReflectionTest(fixtures.TestBase):
m1 = MetaData(conn)
- t1_schema = Table(
- "some_table", m1, schema="test_schema", autoload=True
- )
+ Table("some_table", m1, schema="test_schema", autoload=True)
t2_schema = Table(
"some_other_table", m1, schema="test_schema_2", autoload=True
)
@@ -855,7 +853,7 @@ class ReflectionTest(fixtures.TestBase):
metadata = self.metadata
- t1 = Table(
+ Table(
"party",
metadata,
Column("id", String(10), nullable=False),
@@ -994,7 +992,7 @@ class ReflectionTest(fixtures.TestBase):
metadata = self.metadata
- t1 = Table(
+ Table(
"t",
metadata,
Column("id", Integer, primary_key=True),
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index e55754f1b..72335ebe3 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -68,7 +68,7 @@ class FloatCoercionTest(fixtures.TablesTest, AssertsExecutionResults):
@classmethod
def define_tables(cls, metadata):
- data_table = Table(
+ Table(
"data_table",
metadata,
Column("id", Integer, primary_key=True),
@@ -328,9 +328,9 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults):
metadata = self.metadata
e1 = Enum("one", "two", "three", name="myenum")
- t1 = Table("e1", metadata, Column("c1", e1))
+ Table("e1", metadata, Column("c1", e1))
- t2 = Table("e2", metadata, Column("c1", e1))
+ Table("e2", metadata, Column("c1", e1))
metadata.create_all(checkfirst=False)
metadata.drop_all(checkfirst=False)
@@ -349,7 +349,7 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults):
"""
metadata = self.metadata
- e1 = Enum("one", "two", "three", name="myenum", metadata=self.metadata)
+ Enum("one", "two", "three", name="myenum", metadata=self.metadata)
metadata.create_all(checkfirst=False)
assert "myenum" in [e["name"] for e in inspect(testing.db).get_enums()]
@@ -525,7 +525,7 @@ class EnumTest(fixtures.TestBase, AssertsExecutionResults):
etype = Enum(
"four", "five", "six", name="fourfivesixtype", metadata=metadata
)
- t1 = Table(
+ Table(
"table",
metadata,
Column("id", Integer, primary_key=True),
@@ -773,7 +773,7 @@ class NumericInterpretationTest(fixtures.TestBase):
Column("ff", Float(asdecimal=False), default=1),
)
metadata.create_all()
- r = t.insert().execute()
+ t.insert().execute()
row = t.select().execute().first()
assert isinstance(row[1], decimal.Decimal)
@@ -1890,7 +1890,7 @@ class UUIDTest(fixtures.TestBase):
def setup(self):
self.conn = testing.db.connect()
- trans = self.conn.begin()
+ self.conn.begin()
def teardown(self):
self.conn.close()