Add test for virtual district
This commit is contained in:
@@ -5564,5 +5564,42 @@ class TestApi:
|
|||||||
self.leave(p)
|
self.leave(p)
|
||||||
|
|
||||||
|
|
||||||
|
# 37 virtual_district
|
||||||
|
|
||||||
|
def test_virtual_district(self):
|
||||||
|
p = 'test_virtual_district'
|
||||||
|
read_inp(p, f'./inp/net3.inp', '3')
|
||||||
|
|
||||||
|
open_project(p)
|
||||||
|
|
||||||
|
result = calculate_virtual_district(p, ['107', '139', '267', '211'])
|
||||||
|
|
||||||
|
assert result == {
|
||||||
|
'virtual_districts':[
|
||||||
|
{
|
||||||
|
'center': '107',
|
||||||
|
'nodes': ['10', '101', '103', '105', '109', '111', '115', '117', '119', '120', '139', '257', '259', '261', '263', '267', 'Lake'],
|
||||||
|
'boundary': [(23.38, 12.95), (12.96, 21.31), (8.0, 27.53), (9.0, 27.85), (33.28, 24.54), (23.38, 12.95)]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'center': '139',
|
||||||
|
'nodes': ['15', '20', '60', '601', '61', '121', '123', '125', '127', '129', '131', '141', '143', '145', '147', '149', '151', '153', 'River', '3'],
|
||||||
|
'boundary': [(33.02, 19.29), (30.24, 20.38), (28.29, 21.39), (23.54, 25.5), (23.0, 29.49), (24.15, 31.06), (37.89, 29.55), (38.68, 23.76), (37.47, 21.97), (33.02, 19.29)]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'center': '267',
|
||||||
|
'nodes': ['35', '40', '113', '157', '159', '161', '163', '164', '166', '167', '169', '171', '173', '177', '179', '181', '183', '184', '185', '187', '189', '191', '193', '195', '197', '204', '211', '265', '269', '271', '1', '107'],
|
||||||
|
'boundary': [(34.2, 5.54), (25.15, 9.52), (23.64, 11.04), (20.97, 15.18), (18.45, 20.46), (24.85, 20.16), (34.2, 5.54)]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'center': '211',
|
||||||
|
'nodes': ['50', '199', '201', '203', '205', '206', '207', '208', '209', '213', '215', '217', '219', '225', '229', '231', '237', '239', '241', '243', '247', '249', '251', '253', '255', '273', '275', '2'],
|
||||||
|
'boundary': [(37.04, 0.0), (34.15, 1.1), (32.17, 1.88), (29.2, 6.46), (29.16, 7.38), (29.42, 8.44), (31.14, 8.89), (44.86, 9.32), (43.53, 7.38), (37.04, 0.0)]
|
||||||
|
}],
|
||||||
|
'isolated_nodes': []}
|
||||||
|
|
||||||
|
self.leave(p)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pytest.main()
|
pytest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user