-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpumbaku_test.py
37 lines (31 loc) · 1.29 KB
/
pumbaku_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from pumbaku import find_haiku
def test_a_valid_haiku():
message = find_haiku('An old silent pond. A frog jumps into the pond. Splash silence again')
assert message == (
'AN OLD SILENT POND\n'
'A FROG JUMPS INTO THE POND\n'
'SPLASH SILENCE AGAIN'
)
def test_a_valid_haiku_with_new_lines():
message = find_haiku('An old silent pond.\nA frog jumps into the pond.\nSplash silence again')
assert message == (
'AN OLD SILENT POND\n'
'A FROG JUMPS INTO THE POND\n'
'SPLASH SILENCE AGAIN'
)
def test_an_unknown_word():
message = find_haiku('An old silent crazybus. A frog jumps into the pond. Splash silence again')
assert message == 'PUMBAKU DO NOT KNOW CRAZYBUS'
def test_not_a_valid_haiku():
message = find_haiku('haiku')
assert message == 'HAS 2 SYLLABLES! IS NOT HAIKU!'
def test_not_a_valid_haiku_with_too_many_syllables():
message = find_haiku('hi ' * 18)
assert message == 'HAS 18 SYLLABLES! IS NOT HAIKU!'
def test_a_valid_haiku_with_commas():
message = find_haiku('An old silent pond, A frog jumps into the pond, Splash silence again')
assert message == (
'AN OLD SILENT POND\n'
'A FROG JUMPS INTO THE POND\n'
'SPLASH SILENCE AGAIN'
)