Skip to content

Commit

Permalink
Merge pull request #179 from SpiNNakerManchester/coverage
Browse files Browse the repository at this point in the history
increate testing of data view
  • Loading branch information
rowleya authored Nov 27, 2023
2 parents c1258cb + d37dbe4 commit dac8398
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spinn_machine/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def where_is_chip(self, chip: Chip) -> str:
return (f"global chip {chip.x}, {chip.y} on {chip00.ip_address} "
f"is chip {localx}, {localy} {ip_address}")
except Exception: # pylint: disable=broad-except
return str(Chip)
return str(chip)

def where_is_xy(self, x: int, y: int) -> str:
"""
Expand Down
10 changes: 9 additions & 1 deletion unittests/data/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,18 @@ def test_where_is_setup(self):
self.assertEqual(
"No Machine created yet",
MachineDataView.where_is_xy(1, 0))
writer.set_machine(virtual_machine(width=12, height=12))
machine = virtual_machine(width=12, height=12)
writer.set_machine(machine)
self.assertEqual(
"global chip 11, 11 on 127.0.0.0 is chip 7, 3 on 127.0.4.8",
MachineDataView.where_is_xy(11, 11))
self.assertEqual(
"No chip -1, 11 found",
MachineDataView.where_is_xy(-1, 11))
self.assertEqual(
"global chip 2, 8 on 127.0.0.0 is chip 6, 4 on 127.0.8.4",
MachineDataView.where_is_chip(machine.get_chip_at(2, 8)))
self.assertEqual(
"None",
MachineDataView.where_is_chip(None)
)

0 comments on commit dac8398

Please sign in to comment.