diff --git a/exercises/bob/bob_test.py b/exercises/bob/bob_test.py index db070e51c9..0d44a1a710 100644 --- a/exercises/bob/bob_test.py +++ b/exercises/bob/bob_test.py @@ -3,7 +3,7 @@ import bob -# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0 +# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0 class BobTests(unittest.TestCase): def test_stating_something(self): @@ -36,7 +36,9 @@ def test_using_acronyms_in_regular_speech(self): def test_forceful_question(self): self.assertEqual( - bob.hey("WHAT THE HELL WERE YOU THINKING?"), "Whoa, chill out!") + bob.hey("WHAT THE HELL WERE YOU THINKING?"), + "Calm down, I know what I'm doing!" + ) def test_shouting_numbers(self): self.assertEqual(bob.hey("1, 2, 3 GO!"), "Whoa, chill out!") diff --git a/exercises/bob/example.py b/exercises/bob/example.py index c38842fd57..5932176167 100644 --- a/exercises/bob/example.py +++ b/exercises/bob/example.py @@ -3,8 +3,11 @@ def hey(stimulus): if _is_silence(stimulus): return 'Fine. Be that way!' - elif _is_shouting(stimulus): - return 'Whoa, chill out!' + if _is_shouting(stimulus): + if _is_question(stimulus): + return "Calm down, I know what I'm doing!" + else: + return 'Whoa, chill out!' elif _is_question(stimulus): return 'Sure.' else: