def test_is_traveling(self): travelcalculator = TravelCalculator(64, 128) self.assertFalse(travelcalculator.is_traveling()) travelcalculator.set_position(128) self.assertFalse(travelcalculator.is_traveling()) travelcalculator.time_set_from_outside = 1000 travelcalculator.start_travel_down() travelcalculator.time_set_from_outside = 1001 self.assertTrue(travelcalculator.is_traveling()) travelcalculator.time_set_from_outside = 1032 self.assertFalse(travelcalculator.is_traveling())
def test_travel_full_down(self): travelcalculator = TravelCalculator(64, 128) travelcalculator.set_position(128) travelcalculator.time_set_from_outside = 1000 travelcalculator.start_travel_down() travelcalculator.time_set_from_outside = 1031 self.assertFalse(travelcalculator.position_reached()) self.assertFalse(travelcalculator.is_closed()) self.assertFalse(travelcalculator.is_open()) travelcalculator.time_set_from_outside = 1032 self.assertTrue(travelcalculator.position_reached()) self.assertTrue(travelcalculator.is_closed()) self.assertFalse(travelcalculator.is_open())