Skip to content

Commit

Permalink
flake8 test_grep.py
Browse files Browse the repository at this point in the history
  • Loading branch information
James McKinney committed Jan 22, 2016
1 parent dde3e85 commit fbefdf0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_grep.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from csvkit.grep import FilteringCSVReader
from csvkit.exceptions import ColumnIdentifierError


class TestGrep(unittest.TestCase):
def setUp(self):
self.tab1 = [
Expand All @@ -24,7 +25,7 @@ def setUp(self):
[u'1', u'first', u'0'],
[u'4', u'only', u'0'],
[u'1', u'second', u'0'],
[u'2', u'only', u'0', u'0']] # Note extra value in this column
[u'2', u'only', u'0', u'0']] # Note extra value in this column

def test_pattern(self):
fcr = FilteringCSVReader(iter(self.tab1), patterns=['1'])
Expand All @@ -50,7 +51,7 @@ def test_no_header(self):
def test_regex(self):
pattern = re.compile(".*(Reader|Tribune).*")
fcr = FilteringCSVReader(iter(self.tab1), patterns={1: pattern})

self.assertEqual(self.tab1[0], next(fcr))
self.assertEqual(self.tab1[1], next(fcr))
self.assertEqual(self.tab1[3], next(fcr))
Expand All @@ -60,7 +61,7 @@ def test_regex(self):
self.fail("Should be no more rows left.")
except StopIteration:
pass

def test_inverse(self):
fcr = FilteringCSVReader(iter(self.tab2), patterns=['1'], inverse=True)
self.assertEqual(self.tab2[0], next(fcr))
Expand All @@ -71,7 +72,7 @@ def test_inverse(self):
self.fail("Should be no more rows left.")
except StopIteration:
pass

def test_column_names_in_patterns(self):
fcr = FilteringCSVReader(iter(self.tab2), patterns={'age': 'only'})
self.assertEqual(self.tab2[0], next(fcr))
Expand All @@ -95,7 +96,7 @@ def test_mixed_indices_and_column_names_in_patterns(self):

def test_duplicate_column_ids_in_patterns(self):
try:
fcr = FilteringCSVReader(iter(self.tab2), patterns={'age': 'only', 1: 'second'})
FilteringCSVReader(iter(self.tab2), patterns={'age': 'only', 1: 'second'})
self.fail("Should be an exception.")
except ColumnIdentifierError:
pass
Expand Down

0 comments on commit fbefdf0

Please sign in to comment.