Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Article 'QA in Python - working with unittest'
import unittest
class BaseTestClass(unittest.TestCase):
def test_add(self):
self.assertEquals(120, 100 + 20)
self.assertFalse(10 > 20)
self.assertGreater(120, 100)
def test_sub(self):
self.assertEquals(100, 140 - 40)
if __name__ == '__main__':
unittest.main()
# CLI run options
#
# - pyexample_1.py -v
# - pyexample_1.py -v BaseTestClass
# - pyexample_1.py -v BaseTestClass.test_add
# - pyexample_1.py -v BaseTestClass.test_sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment