Created
February 10, 2013 13:33
-
-
Save gahcep/4749595 to your computer and use it in GitHub Desktop.
Article 'QA in Python - working with unittest'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
class FirstTestClass(unittest.TestCase): | |
def test_add(self): | |
self.assertEquals(120, 100 + 20) | |
class SecondTestClass(unittest.TestCase): | |
def test_sub(self): | |
self.val = 210 | |
self.assertEquals(210, self.val) | |
self.val = self.val - 40 | |
self.assertEquals(170, self.val) | |
def test_mul(self): | |
self.val = 210 | |
self.assertEquals(420, self.val * 2) | |
if __name__ == '__main__': | |
unittest.main() | |
# CLI run options | |
# - pyexample_2.py -v | |
# - pyexample_2.py -v FirstTestClass | |
# - pyexample_2.py -v SecondTestClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment