Skip to content

Instantly share code, notes, and snippets.

@DavidPiper94
Last active September 24, 2019 14:24
Show Gist options
  • Save DavidPiper94/a5555d2cbff0d4c532ecdb3123487777 to your computer and use it in GitHub Desktop.
Save DavidPiper94/a5555d2cbff0d4c532ecdb3123487777 to your computer and use it in GitHub Desktop.
Example code for article about unit tests - ExampleTest
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()
@DavidPiper94
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment