Add reservoir test case

This commit is contained in:
wqy
2022-09-17 19:38:43 +08:00
parent 89ffd15b7b
commit b8d2efdc66
6 changed files with 57 additions and 20 deletions

View File

@@ -23,10 +23,7 @@ def get_node_coord(name: str, id: str) -> dict[str, float] | None:
return _to_point(coord)
def set_node_coord(name: str, id: str, x: float, y: float) -> ChangeSet:
if not is_junction(name, id):
return ChangeSet()
def set_node_coord(name: str, node_type: str, id: str, x: float, y: float) -> ChangeSet:
old = get_node_coord(name, id)
if old == None:
return ChangeSet()
@@ -42,5 +39,5 @@ def set_node_coord(name: str, id: str, x: float, y: float) -> ChangeSet:
add_operation(name, redo, undo)
change = ChangeSet()
change.update('junction', id, 'coord', 'point', str({'x': x, 'y': y}))
change.update(node_type, id, 'coord', 'point', str({'x': x, 'y': y}))
return change