Coverage for app/schemas/move.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-16 20:06 +0000

1from uuid import UUID 

2from pydantic import BaseModel, ConfigDict, Field 

3 

4from app.schemas.direction import Direction 

5 

6 

7class MoveRequest(BaseModel): 

8 id: UUID = Field(..., description="Saved probe UUID") 

9 command: str = Field( 

10 ..., 

11 description="Commands to run on the probe. Available commands: M (move forward, according to current probe's cardinal orientation), L (turn left), R (turn right). Note: in case of invalid commands or commands with invalid outcomes, no changes will be applied on the probe state.", 

12 min_length=1, 

13 ) 

14 

15 model_config = ConfigDict(str_strip_whitespace=True) 

16 

17 

18class MoveResponse(BaseModel): 

19 id: UUID = Field(..., description="Saved probe UUID") 

20 x: int = Field( 

21 ..., ge=0, description="Probe `x` position, greater than or equal to zero." 

22 ) 

23 y: int = Field( 

24 ..., ge=0, description="Probe `y` position, greater than or equal to zero." 

25 ) 

26 direction: Direction = Field(..., description="Probe cardinal orientation.")