Coverage for app/domain/probe/commands/turn_left_command.py: 100%

10 statements  

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

1from app.domain.probe.commands.command import Command 

2from app.domain.probe.entities.grid import Grid 

3from app.domain.probe.entities.probe import Probe 

4from app.schemas.direction import Direction 

5 

6 

7class TurnLeft(Command): 

8 def execute(self, probe: Probe, grid: Grid) -> Probe: 

9 directions = { 

10 Direction.NORTH: Direction.WEST, 

11 Direction.SOUTH: Direction.EAST, 

12 Direction.EAST: Direction.NORTH, 

13 Direction.WEST: Direction.SOUTH, 

14 } 

15 

16 new_direction = directions[probe.direction] 

17 new_probe = Probe(x=probe.x, y=probe.y, direction=new_direction) 

18 

19 return new_probe