Skip to content

Commit b0384cb

Browse files
cmccandlessNathan Parsons
authored andcommitted
bob: Update to clarify ambiguity regarding shouted questions (exercism#1167)
* bob: Update to clarify ambiguity regarding shouted questions Fixes exercism#1166
1 parent 8ef6587 commit b0384cb

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

exercises/bob/bob_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import bob
44

55

6-
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
6+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
77

88
class BobTests(unittest.TestCase):
99
def test_stating_something(self):
@@ -36,7 +36,9 @@ def test_using_acronyms_in_regular_speech(self):
3636

3737
def test_forceful_question(self):
3838
self.assertEqual(
39-
bob.hey("WHAT THE HELL WERE YOU THINKING?"), "Whoa, chill out!")
39+
bob.hey("WHAT THE HELL WERE YOU THINKING?"),
40+
"Calm down, I know what I'm doing!"
41+
)
4042

4143
def test_shouting_numbers(self):
4244
self.assertEqual(bob.hey("1, 2, 3 GO!"), "Whoa, chill out!")

exercises/bob/example.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ def hey(stimulus):
33

44
if _is_silence(stimulus):
55
return 'Fine. Be that way!'
6-
elif _is_shouting(stimulus):
7-
return 'Whoa, chill out!'
6+
if _is_shouting(stimulus):
7+
if _is_question(stimulus):
8+
return "Calm down, I know what I'm doing!"
9+
else:
10+
return 'Whoa, chill out!'
811
elif _is_question(stimulus):
912
return 'Sure.'
1013
else:

0 commit comments

Comments
 (0)