class DeadReckonerTestCase(unittest.TestCase): def setUp(self): print 'In setUp' self.algorithm = TESTREAalgorithm(initialState) self.stateSeeker = TESTEntityStateSeeker(initialState) self.reckoner = DeadReckoner(self.algorithm, self.stateSeeker) def test_extrapolated_position(self): print "Running test_extrapolated_position" self.reckoner.updateDeadReckonedState(3.1) self.assertAlmostEqual(self.reckoner._lastREAstate['time'], 3.1) self.assertAlmostEqual(self.reckoner._lastREAstate['px'], initialState['px']+1.0) self.assertAlmostEqual(self.reckoner._lastREAstate['py'], initialState['py']+1.0) self.assertAlmostEqual(self.reckoner._lastREAstate['pz'], initialState['pz']+1.0) self.assertAlmostEqual(self.reckoner._trueState['time'], 2.1) self.assertAlmostEqual(self.reckoner._trueState['px'], initialState['px']) self.assertAlmostEqual(self.reckoner._trueState['py'], initialState['py']) self.assertAlmostEqual(self.reckoner._trueState['pz'], initialState['pz']) def test_updated_position(self): print "Running test_extrapolated_position" self.reckoner.updateTrueState(finalConstAstate) self.assertAlmostEqual(self.reckoner._lastREAstate['time'], finalConstAstate['time']) self.assertAlmostEqual(self.reckoner._lastREAstate['px'], finalConstAstate['px']) self.assertAlmostEqual(self.reckoner._lastREAstate['py'], finalConstAstate['py']) self.assertAlmostEqual(self.reckoner._lastREAstate['pz'], finalConstAstate['pz']) self.assertAlmostEqual(self.reckoner._trueState['time'], finalConstAstate['time']) self.assertAlmostEqual(self.reckoner._trueState['px'], finalConstAstate['px']) self.assertAlmostEqual(self.reckoner._trueState['py'], finalConstAstate['py']) self.assertAlmostEqual(self.reckoner._trueState['pz'], finalConstAstate['pz']) def tearDown(self): print 'In tearDown' del self.reckoner del self.algorithm del self.stateSeeker
def setUp(self): print 'In setUp' self.algorithm = TESTREAalgorithm(initialState) self.stateSeeker = TESTEntityStateSeeker(initialState) self.reckoner = DeadReckoner(self.algorithm, self.stateSeeker)