• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 44. Writing Tests Against Interf... > Writing Tests for the Implementation...

Writing Tests for the Implementations

These two implementations are different enough that the interface tests would fail if you had included implementation-specific testing code. You can now implement the tests quickly:

01 class TestSample1(TestISample):
02
03     def makeTestObject(self):
04         return Sample1()
05
06     # Sample1-specific tests are here
07
08
09 class TestSample2(TestISample):
10
11     def makeTestObject(self):
12         return Sample2()
13
14     # Sample2-specific tests are here
15
16
17 def test_suite():
18     return unittest.TestSuite((
19         unittest.makeSuite(TestSample1),
20         unittest.makeSuite(TestSample2)
21         ))
22
23 if __name__ == '__main__':
24     unittest.main(defaultTest='test_suite')


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint