Coverage for app/domain/services/CommandRunner.py: 100%

12 statements  

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

1from app.domain.probe.commands.factory import CommandFactory 

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

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

4 

5 

6class CommandRunner: 

7 def __init__(self, grid: Grid): 

8 self.grid = grid 

9 

10 def run(self, probe: Probe, commands: str) -> Probe: 

11 new_probe = Probe(x=probe.x, y=probe.y, direction=probe.direction) 

12 

13 for command_str in commands: 

14 command = CommandFactory.create(command_str) 

15 new_probe = command.execute(new_probe, self.grid) 

16 

17 return new_probe