Skip to content

Commit

Permalink
Compress three functions into one
Browse files Browse the repository at this point in the history
  • Loading branch information
youthinkk committed Mar 8, 2016
1 parent f5f38a2 commit 9171ef8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,9 @@ def test_argmax_gen():
assert argmax_list(['one', 'three', 'seven'], len) == ['three', 'seven']


def test_histogram_no_function():
def test_histogram():
assert histogram([1, 2, 4, 2, 4, 5, 7, 9, 2, 1]) == [(1, 2), (2, 3), (4, 2), (5, 1), (7, 1), (9, 1)]


def test_histogram_with_function():
assert histogram([1, 2, 4, 2, 4, 5, 7, 9, 2, 1], 0, lambda x: x*x) == [(1, 2), (4, 3), (16, 2), (25, 1), (49, 1), (81, 1)]


def test_histogram_with_mode_one():
assert histogram([1, 2, 4, 2, 4, 5, 7, 9, 2, 1], 1) == [(2, 3), (4, 2), (1, 2), (9, 1), (7, 1), (5, 1)]


Expand Down

0 comments on commit 9171ef8

Please sign in to comment.