test_db_weighing_complete.py 773 B

123456789101112131415161718192021222324252627
  1. """只填皮重时,不应因为补了毛重时间而把出入库单算作已完成。"""
  2. from datetime import datetime
  3. from app.services.db.weighing_logic import weighing_weights_complete
  4. def test_tare_only_is_not_complete():
  5. assert (
  6. weighing_weights_complete(0, datetime(2026, 10, 28, 17, 0), 12000, datetime(2026, 10, 28, 17, 1))
  7. is False
  8. )
  9. def test_missing_gross_time_is_not_complete():
  10. assert weighing_weights_complete(32000, None, 12000, datetime(2026, 10, 28, 17, 1)) is False
  11. def test_both_weights_and_times_are_complete():
  12. assert (
  13. weighing_weights_complete(
  14. 32000,
  15. datetime(2026, 10, 28, 17, 0),
  16. 12000,
  17. datetime(2026, 10, 28, 17, 1),
  18. )
  19. is True
  20. )