Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created June 17, 2013 07:54
Show Gist options
  • Save elleryq/5795302 to your computer and use it in GitHub Desktop.
Save elleryq/5795302 to your computer and use it in GitHub Desktop.
Python unittest sample The sample comes from Pro Python Chapter 9
"""
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