Skip to content

Commit

Permalink
two_fer sync with canon
Browse files Browse the repository at this point in the history
  • Loading branch information
Grociu committed May 31, 2019
1 parent 1103a74 commit eb62639
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions exercises/two-fer/example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def two_fer(name=""):
if not name.strip():
def two_fer(name=None):
if not name:
return "One for you, one for me."
else:
return "One for {}, one for me.".format(name)
2 changes: 1 addition & 1 deletion exercises/two-fer/two_fer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TwoFerTest(unittest.TestCase):
def test_no_name_given(self):
self.assertEqual(two_fer(), 'One for you, one for me.')
self.assertEqual(two_fer(None), 'One for you, one for me.')

def test_a_name_given(self):
self.assertEqual(two_fer("Alice"), "One for Alice, one for me.")
Expand Down

1 comment on commit eb62639

@yawpitch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider the example.py in this commit to be an unacceptable solution to two-fer.

Assuming we do want students to handle the entirely un-Pythonic explicit two_fer(None) form (and not the Pythonic two_fer() form) we should at minimum expect something like:

def two_fer(name=None):
    return "One for {}, one for me.".format(name or "you")

Please sign in to comment.