Skip to content

Instantly share code, notes, and snippets.

@gahcep
Created February 10, 2013 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gahcep/4749602 to your computer and use it in GitHub Desktop.
Save gahcep/4749602 to your computer and use it in GitHub Desktop.
Article 'QA in Python - working with unittest'
import unittest
class BaseTestClass(unittest.TestCase):
def test_ok(self):
self.assertEquals(210, 110 * 2 - 10)
@unittest.skip('not supported')
def test_skip(self):
self.assertEquals(1000, 10 * 10 * 10)
def test_fail(self):
self.assertEquals(420, 210 * 2.1)
def test_error(self):
raise ZeroDivisionError('Error! Division by zero')
@unittest.expectedFailure
def test_expected(self):
raise ZeroDivisionError('Error! Division by zero')
@unittest.expectedFailure
def test_unexpected_ok(self):
self.assertEquals(1, 1)
if __name__ == '__main__':
unittest.main()
# CLI run options
# - pyexample_4_status.py -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment