Add valve test case

This commit is contained in:
wqy
2022-09-17 23:09:43 +08:00
parent ec3dff12b0
commit 96c01d7fc8
3 changed files with 121 additions and 3 deletions

View File

@@ -19,6 +19,8 @@ def add_valve(name: str, id: str, node1: str, node2: str, diameter: float = 0, t
return ChangeSet()
if node1 == node2:
return ChangeSet()
if type != VALVES_TYPE_PRV and type != VALVES_TYPE_PSV and type != VALVES_TYPE_PBV and type != VALVES_TYPE_FCV and type != VALVES_TYPE_TCV and type != VALVES_TYPE_GPV:
return ChangeSet()
sql = f"insert into valves (id, node1, node2, diameter, type, setting, minor_loss) values ('{id}', '{node1}', '{node2}', {diameter}, '{type}', {setting}, {minor_loss});"
undo_sql = f'delete from valves where id = "{id}";'