Skip to content

bob: Update to clarify ambiguity regarding shouted questions #1167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions exercises/bob/bob_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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!")
Expand Down
7 changes: 5 additions & 2 deletions exercises/bob/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down