Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Example of test subclassing.
- """
- import unittest
- class CommonStuff (unittest.TestCase):
- def setUp(self):
- print "CommonStuff: setup (class={} self={})".format(self.__class__.__name__, id(self))
- def tearDown(self):
- print "CommonStuff: tearDown (class={} self={})".format(self.__class__.__name__, id(self))
- class TestOne (CommonStuff):
- def setUp(self):
- super(TestOne, self).setUp()
- print "TestOne: setup (class={} self={})".format(self.__class__.__name__, id(self))
- def tearDown(self):
- print "TestOne: tearDown (class={} self={})".format(self.__class__.__name__, id(self))
- super(TestOne, self).tearDown()
- def test_1(self):
- print "TestOne: test_1"
- def test_2(self):
- print "TestOne: test_2"
- class TestTwo (CommonStuff):
- def test_3(self):
- print "TestTwo: test_3"
- def test_4(self):
- print "TestTwo: test_4"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement