Skip to content

Commit 60a4285

Browse files
sofmonknorvig
authored andcommitted
update test_utils.py (#466)
added test for count() and mode()
1 parent dc8989f commit 60a4285

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def test_unique():
1818
assert unique([1, 5, 6, 7, 6, 5]) == [1, 5, 6, 7]
1919

2020

21+
def test_count():
22+
assert count([1, 2, 3, 4, 2, 3, 4]) == 7
23+
assert count("aldpeofmhngvia") == 14
24+
25+
2126
def test_product():
2227
assert product([1, 2, 3, 4]) == 24
2328
assert product(list(range(1, 11))) == 3628800
@@ -38,6 +43,11 @@ def test_is_in():
3843
assert is_in(e, [1, [], 3]) is False
3944

4045

46+
def test_mode():
47+
assert mode([12, 32, 2, 1, 2, 3, 2, 3, 2, 3, 44, 3, 12, 4, 9, 0, 3, 45, 3]) == 3
48+
assert mode("absndkwoajfkalwpdlsdlfllalsflfdslgflal") == 'l'
49+
50+
4151
def test_argminmax():
4252
assert argmin([-2, 1], key=abs) == 1
4353
assert argmax([-2, 1], key=abs) == -2

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy