Skip to content

Commit 187aba4

Browse files
committed
test: add edge-case doctests to is_isogram
1 parent 6e03a48 commit 187aba4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎strings/is_isogram.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,26 @@ def is_isogram(string: str) -> bool:
1111
True
1212
>>> is_isogram('allowance')
1313
False
14+
>>> is_isogram('')
15+
True
16+
>>> is_isogram('a')
17+
True
18+
>>> is_isogram('Alphabet')
19+
False
20+
>>> is_isogram('subdermatoglyphic')
21+
True
1422
>>> is_isogram('copy1')
1523
Traceback (most recent call last):
1624
...
1725
ValueError: String must only contain alphabetic characters.
26+
>>> is_isogram('hello world')
27+
Traceback (most recent call last):
28+
...
29+
ValueError: String must only contain alphabetic characters.
30+
>>> is_isogram('isogram!')
31+
Traceback (most recent call last):
32+
...
33+
ValueError: String must only contain alphabetic characters.
1834
"""
1935
if not all(x.isalpha() for x in string):
2036
raise ValueError("String must only contain alphabetic characters.")

0 commit comments

Comments
 (0)