test_pl_transport_address_notes_schema.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. """运输地址库 Schema 接受 notes。"""
  2. from __future__ import annotations
  3. from decimal import Decimal
  4. from app.schemas.pl.transport_address import TransportAddressCreate, TransportAddressUpdate
  5. def test_transport_address_create_accepts_notes():
  6. body = TransportAddressCreate.model_validate(
  7. {
  8. "addressName": "测试仓",
  9. "fullAddress": "安庆市某某路1号",
  10. "lng": Decimal("117.0"),
  11. "lat": Decimal("30.5"),
  12. "notes": "大门左侧卸货",
  13. }
  14. )
  15. assert body.notes == "大门左侧卸货"
  16. def test_transport_address_update_accepts_notes():
  17. body = TransportAddressUpdate.model_validate({"notes": "进厂需报备"})
  18. assert body.notes == "进厂需报备"
  19. def test_transport_address_create_notes_optional():
  20. body = TransportAddressCreate.model_validate(
  21. {
  22. "addressName": "测试仓",
  23. "fullAddress": "安庆市某某路1号",
  24. "lng": Decimal("117.0"),
  25. "lat": Decimal("30.5"),
  26. }
  27. )
  28. assert body.notes is None