From 205a8763ffeac0ab7e9ca1a04a9831b4cd4ed6f7 Mon Sep 17 00:00:00 2001 From: Angira Sharma Date: Sat, 1 Apr 2017 21:15:42 +0530 Subject: [PATCH] update test_utils.py added test for count() and mode() --- tests/test_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 76e0421b3..5ca973e09 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -18,6 +18,11 @@ def test_unique(): assert unique([1, 5, 6, 7, 6, 5]) == [1, 5, 6, 7] +def test_count(): + assert count([1, 2, 3, 4, 2, 3, 4]) == 7 + assert count("aldpeofmhngvia") == 14 + + def test_product(): assert product([1, 2, 3, 4]) == 24 assert product(list(range(1, 11))) == 3628800 @@ -38,6 +43,11 @@ def test_is_in(): assert is_in(e, [1, [], 3]) is False +def test_mode(): + assert mode([12, 32, 2, 1, 2, 3, 2, 3, 2, 3, 44, 3, 12, 4, 9, 0, 3, 45, 3]) == 3 + assert mode("absndkwoajfkalwpdlsdlfllalsflfdslgflal") == 'l' + + def test_argminmax(): assert argmin([-2, 1], key=abs) == 1 assert argmax([-2, 1], key=abs) == -2