test_gui_motion_actions.py 993 B

123456789101112131415161718192021222324252627282930
  1. """A thermal SET after a motion must not replay that motion selection."""
  2. import sys
  3. import unittest
  4. from pathlib import Path
  5. sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "tools"))
  6. from prod2u_gui import reset_motor_actions
  7. class Value:
  8. def __init__(self, value):
  9. self.value = value
  10. def set(self, value):
  11. self.value = value
  12. class MotionActionTests(unittest.TestCase):
  13. def test_only_actions_reset_after_transmission(self):
  14. slots = [{"action_var": Value(action), "steps_var": Value("123"),
  15. "half_var": Value("1000")}
  16. for action in ("PUSH_UP", "PUSH_DOWN", "STOP_CLEAR", "NOTHING")]
  17. reset_motor_actions(slots)
  18. self.assertEqual([s["action_var"].value for s in slots], ["NOTHING"] * 4)
  19. self.assertEqual([s["steps_var"].value for s in slots], ["123"] * 4)
  20. self.assertEqual([s["half_var"].value for s in slots], ["1000"] * 4)
  21. if __name__ == "__main__":
  22. unittest.main()