Last active
September 24, 2019 14:24
-
-
Save DavidPiper94/a5555d2cbff0d4c532ecdb3123487777 to your computer and use it in GitHub Desktop.
Example code for article about unit tests - ExampleTest
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
import unittest | |
class ExampleTests(unittest.TestCase): | |
def test_add(self): | |
expectation = 4 | |
actual = 2 + 2 | |
self.assertEqual( | |
expectation, | |
actual, | |
msg = "The sum of 2 + 2 should be {} but is {}".format(expectation, actual) | |
) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link to article: https://medium.com/@HeyDaveTheDev/writing-unit-tests-in-python-d61531d2c3f0