Skip to content

Instantly share code, notes, and snippets.

@gahcep
Created February 10, 2013 13:31
Show Gist options
  • Save gahcep/4749593 to your computer and use it in GitHub Desktop.
Save gahcep/4749593 to your computer and use it in GitHub Desktop.
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