icecube.icetray.test_module module¶
- icecube.icetray.test_module.I3TestModuleFactory(*test_cases)¶
Test case factory
Create an I3Module that runs the given unittest test cases on each Physics frame.
Example
Create a simple test case:
class I3TimeHorizonCutTest(unittest.TestCase): def testKeys(self): # All keys are present. self.assertTrue( "InIceRawData" in self.frame, "Up is down, black is white.") self.assertTrue( "InIceRawData_Horizon" in self.frame, "Up is down, black is white.") def testSizeReduction(self): # Output map is ever so slightly smaller. inlaunches = self.frame["InIceRawData"] outlaunches = self.frame["InIceRawData_Horizon"] self.assert_(len(outlaunches) <= len(inlaunches)) def execute_test(frame): return "InIceRawData" in frame and len(frame["InIceRawData"]) > 0 tray.Add( I3TestModuleFactory(I3TimeHorizonCutTest), If=execute_test)