Created
June 17, 2013 07:54
-
-
Save elleryq/5795302 to your computer and use it in GitHub Desktop.
Python unittest sample
The sample comes from Pro Python Chapter 9
This file contains hidden or 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
| """ | |
| The sample comes from Pro Python Chapter 9 | |
| The function: times2 is a module which contains a function. | |
| def times2(value): | |
| return value*2 | |
| """ | |
| import unittest | |
| import times2 | |
| class MultiplicationTestCase(unittest.TestCase): | |
| def setUp(self): | |
| self.factor = 2 | |
| def testNumber(self): | |
| self.assertTrue(times2.times2(5) == 10) | |
| if __name__ == '__main__': | |
| unittest.main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment