Add complex test case

This commit is contained in:
WQY\qiong
2023-03-22 21:55:58 +08:00
parent c6d74e3cad
commit bcdaddc5cf

View File

@@ -185,6 +185,63 @@ class TestApi:
self.leave(p) self.leave(p)
# complex test
def test_delete_node_link_then_restore(self):
p = 'test_remove_node_link_then_restore'
read_inp(p, f'./inp/net3.inp', '2')
open_project(p)
nodes = []
links = []
nodes.append('131')
links += get_node_links(p, nodes[-1])
delete_junction(p, ChangeSet({'id': '131'}))
links.append('137')
delete_pipe(p, ChangeSet({'id': '137'}))
nodes.append('129')
links += get_node_links(p, nodes[-1])
delete_junction(p, ChangeSet({'id': '129'}))
nodes.append('127')
links += get_node_links(p, nodes[-1])
delete_junction(p, ChangeSet({'id': '127'}))
links.append('135')
delete_pipe(p, ChangeSet({'id': '135'}))
links.append('135')
delete_pipe(p, ChangeSet({'id': '133'}))
nodes.append('20')
links += get_node_links(p, nodes[-1])
delete_junction(p, ChangeSet({'id': '20'}))
nodes.append('3')
links += get_node_links(p, nodes[-1])
delete_tank(p, ChangeSet({'id': '3'}))
for node in nodes:
assert is_node(p, node) == False
for link in links:
assert is_link(p, link) == False
op = get_restore_operation(p)
pick_operation(p, op)
for node in nodes:
assert is_node(p, node)
for link in links:
assert is_link(p, link)
self.leave(p)
# 1 title # 1 title