Test pipe cascade deletion
This commit is contained in:
@@ -1085,6 +1085,55 @@ class TestApi:
|
||||
self.leave(p)
|
||||
|
||||
|
||||
def test_pipe_del(self):
|
||||
p = 'test_pipe_del'
|
||||
self.enter(p)
|
||||
|
||||
add_junction(p, ChangeSet({'id': 'j0', 'x': 0.0, 'y': 10.0, 'elevation': 20.0}))
|
||||
add_junction(p, ChangeSet({'id': 'j1', 'x': 0.0, 'y': 10.0, 'elevation': 20.0}))
|
||||
add_pipe(p, ChangeSet({'id': 'p0', 'node1': 'j0', 'node2': 'j1', 'length': 100.0, 'diameter': 10.0, 'roughness': 0.1, 'minor_loss': 0.5, 'status': PIPE_STATUS_OPEN }))
|
||||
set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' }))
|
||||
set_status(p, ChangeSet({'link': 'p0', 'status': LINK_STATUS_OPEN, 'setting': 10.0}))
|
||||
set_pipe_reaction(p, ChangeSet({'pipe': 'p0', 'bulk': 10.0, 'wall': 20.0}))
|
||||
set_vertex(p, ChangeSet({'link' : 'p0', 'coords': [{'x': 1.0, 'y': 2.0}, {'x': 2.0, 'y': 1.0}]}))
|
||||
assert is_pipe(p, 'p0')
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == 'p0t'
|
||||
assert get_status(p, 'p0')['status'] == LINK_STATUS_OPEN
|
||||
assert get_status(p, 'p0')['setting'] == 10.0
|
||||
assert get_pipe_reaction(p, 'p0')['bulk'] == 10.0
|
||||
assert get_pipe_reaction(p, 'p0')['wall'] == 20.0
|
||||
assert get_vertex(p, 'p0')['coords'] == [{'x': 1.0, 'y': 2.0}, {'x': 2.0, 'y': 1.0}]
|
||||
|
||||
delete_pipe(p, ChangeSet({'id': 'p0'}))
|
||||
assert is_pipe(p, 'p0') == False
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == None
|
||||
assert get_status(p, 'p0')['status'] == None
|
||||
assert get_status(p, 'p0')['setting'] == None
|
||||
assert get_pipe_reaction(p, 'p0')['bulk'] == None
|
||||
assert get_pipe_reaction(p, 'p0')['wall'] == None
|
||||
assert get_vertex(p, 'p0')['coords'] == []
|
||||
|
||||
execute_undo(p)
|
||||
assert is_pipe(p, 'p0')
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == 'p0t'
|
||||
assert get_status(p, 'p0')['status'] == LINK_STATUS_OPEN
|
||||
assert get_status(p, 'p0')['setting'] == 10.0
|
||||
assert get_pipe_reaction(p, 'p0')['bulk'] == 10.0
|
||||
assert get_pipe_reaction(p, 'p0')['wall'] == 20.0
|
||||
assert get_vertex(p, 'p0')['coords'] == [{'x': 1.0, 'y': 2.0}, {'x': 2.0, 'y': 1.0}]
|
||||
|
||||
execute_redo(p)
|
||||
assert is_pipe(p, 'p0') == False
|
||||
assert get_tag(p, TAG_TYPE_LINK, 'p0')['tag'] == None
|
||||
assert get_status(p, 'p0')['status'] == None
|
||||
assert get_status(p, 'p0')['setting'] == None
|
||||
assert get_pipe_reaction(p, 'p0')['bulk'] == None
|
||||
assert get_pipe_reaction(p, 'p0')['wall'] == None
|
||||
assert get_vertex(p, 'p0')['coords'] == []
|
||||
|
||||
self.leave(p)
|
||||
|
||||
|
||||
# 6 pump
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user