Skip to content

Instantly share code, notes, and snippets.

@antonagestam
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonagestam/a65502b971d46a8a2697 to your computer and use it in GitHub Desktop.
Save antonagestam/a65502b971d46a8a2697 to your computer and use it in GitHub Desktop.
compare two strings word by word
"""
>>> comp("""Hi folks
... What is the best way to clear a Riak bucket of all key, values after
... running a test?
... I am currently using the Java HTTP API.
... """, """Hi folks
...
... What is the best way to clear a Riak bucket of all key, values after
... running a test?
... I am currently using the Java HTTP API.
... """)
AssertionError: 'folks\nWhat' != 'folks\n\nWhat'
"""
def comp(a, b):
to_list = lambda x: x.split(' ')
a, b = to_list(a), to_list(b)
for a, b in zip(a, b):
self.assertEqual(a, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment