Last active
November 9, 2018 21:41
-
-
Save themichaelyang/072082faa6f3f456c64d1b2b4685dfb9 to your computer and use it in GitHub Desktop.
check( <fn_to_test> )( <fn_args> )( <expected_return> )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check(fn): | |
def run_check(expected, *args): | |
result = fn(*args) | |
if result == expected: | |
print("Test passed: " + fn.__name__ + str(args) + ' == ' + str(expected)) | |
else: | |
print("Test failed: " + fn.__name__ + str(args)) | |
print(" - Expected: " + str(expected)) | |
print(" - Received: " + str(result)) | |
return lambda *args: lambda expected: run_check(expected, *args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment