Skip to content

Commit

Permalink
Merge pull request #637 from nbedi/any-bool
Browse files Browse the repository at this point in the history
Only overwrite agate.Any test if test is None. Closes #636
  • Loading branch information
nbedi committed Oct 30, 2016
2 parents 0d26713 + 3d795e0 commit 97cb37f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion agate/aggregations/any.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def run(self, table):
column = table.columns[self._column_name]
data = column.values()

if isinstance(column.data_type, Boolean):
if isinstance(column.data_type, Boolean) and self._test is None:
return any(data)

return any(self._test(d) for d in data)
1 change: 1 addition & 0 deletions tests/test_aggregations.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def test_any(self):
table = Table(rows, ['test'], [Boolean()])
Any('test').validate(table)
self.assertEqual(Any('test').run(table), False)
self.assertEqual(Any('test', lambda r: not r).run(table), True)

def test_all(self):
rows = [
Expand Down

0 comments on commit 97cb37f

Please sign in to comment.