From 2cf9da068a3278ee6a2582becffa6e18ed746ea2 Mon Sep 17 00:00:00 2001 From: Friedrich Lindenberg Date: Tue, 5 Dec 2017 17:21:08 +0100 Subject: [PATCH] fix flake8 complaints --- dataset/database.py | 2 +- dataset/table.py | 2 +- test/test_dataset.py | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/dataset/database.py b/dataset/database.py index 88b0505..9f4276f 100644 --- a/dataset/database.py +++ b/dataset/database.py @@ -130,7 +130,7 @@ class Database(object): if error_type is None: try: self.commit() - except: + except Exception: with safe_reraise(): self.rollback() else: diff --git a/dataset/table.py b/dataset/table.py index 6275f92..5f3814b 100644 --- a/dataset/table.py +++ b/dataset/table.py @@ -460,7 +460,7 @@ class Table(object): offset=_offset) if len(order_by): query = query.order_by(*order_by) - + conn = self.db.executable if _streamed: conn = self.db.engine.connect() diff --git a/test/test_dataset.py b/test/test_dataset.py index be97000..b9d046c 100644 --- a/test/test_dataset.py +++ b/test/test_dataset.py @@ -300,8 +300,8 @@ class TableTestCase(unittest.TestCase): def test_count(self): assert len(self.tbl) == 6, len(self.tbl) - l = self.tbl.count(place=TEST_CITY_1) - assert l == 3, l + length = self.tbl.count(place=TEST_CITY_1) + assert length == 3, length def test_find(self): ds = list(self.tbl.find(place=TEST_CITY_1)) @@ -430,9 +430,8 @@ class TableTestCase(unittest.TestCase): assert keys[1] == 'place' def test_empty_query(self): - m = self.tbl.find(place='not in data') - l = list(m) # exhaust iterator - assert len(l) == 0 + empty = list(self.tbl.find(place='not in data')) + assert len(empty) == 0, empty class Constructor(dict):