From 06c8f366fda01de1f0c51d6faae00c26ec33dac8 Mon Sep 17 00:00:00 2001 From: "WQY\\qiong" Date: Mon, 1 May 2023 00:08:56 +0800 Subject: [PATCH] Add test for dma --- test_tjnetwork.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test_tjnetwork.py b/test_tjnetwork.py index 8c48857..f3556e7 100644 --- a/test_tjnetwork.py +++ b/test_tjnetwork.py @@ -6217,11 +6217,28 @@ class TestApi: self.leave(p) + # 35 district_metering_area + + + def test_calculate_district_metering_area(self): + p = 'test_calculate_district_metering_area' + read_inp(p, f'./inp/net3.inp', '3') + open_project(p) + + dmas = calculate_district_metering_area(p, get_nodes(p), 3) + assert len(dmas) == 3 + assert dmas[0] == ['173', '184', '185', '199', '2', '201', '203', '205', '206', '207', '208', '209', '211', '213', '215', '217', '219', '225', '229', '231', '237', '239', '241', '243', '247', '249', '251', '253', '255', '273', '275', '50'] + assert dmas[1] == ['1', '10', '101', '103', '109', '111', '113', '161', '163', '164', '166', '167', '169', '171', '179', '181', '183', '187', '189', '191', '193', '195', '197', '204', '265', '267', '269', '271', '35', '40', 'Lake'] + assert dmas[2] == ['105', '107', '115', '117', '119', '120', '121', '123', '125', '127', '129', '131', '139', '141', '143', '145', '147', '149', '15', '151', '153', '157', '159', '20', '257', '259', '261', '263', '3', '60', '601', '61', 'River'] + + self.leave(p) + + # 36 service_area def test_calculate_service_area(self): - p = 'test_virtual_district' + p = 'test_calculate_service_area' read_inp(p, f'./inp/net3.inp', '3') open_project(p) @@ -6244,8 +6261,8 @@ class TestApi: # 37 virtual_district - def test_virtual_district(self): - p = 'test_virtual_district' + def test_calculate_virtual_district(self): + p = 'test_calculate_virtual_district' read_inp(p, f'./inp/net3.inp', '3') open_project(p)