Skip to content

Instantly share code, notes, and snippets.

@enric1994
Last active November 18, 2018 19:51
Show Gist options
  • Save enric1994/368218e14b156903f3997023226dbdc6 to your computer and use it in GitHub Desktop.
Save enric1994/368218e14b156903f3997023226dbdc6 to your computer and use it in GitHub Desktop.
Python Unit Testing
'''Place all the tests in a 'tests' folder,
start the name of each file with 'test' (e.g. test_string.py).
Finally run: $ python -m unittest discover <tests_folder_location>
'''
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment