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_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