def test_identify_mesh_branch_upgrades_quantile90(self): # Fewer branches are congested for >= 10% of the time expected_return = {101} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=1, quantile=0.9) self.assertEqual(branches, expected_return)
def test_identify_mesh_MW_n_2_deny_list(self): expected_return = {101, 103} deny_list = [102, 105] branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=2, method="MW", deny_list=deny_list) self.assertEqual(branches, expected_return)
def test_identify_mesh_MW_n_2_allow_list(self): expected_return = {102, 103} allow_list = {102, 103, 104} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=2, method="MW", allow_list=allow_list) self.assertEqual(branches, expected_return)
def test_identify_mesh_bad_method(self): with self.assertRaises(ValueError): _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=2, method="does not exist")
def test_identify_mesh_MWmiles_n_1(self): expected_return = {101} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=1, method="MWmiles") self.assertEqual(branches, expected_return)
def test_identify_mesh_MW_n_2(self): expected_return = {101, 102} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=2, method="MW") self.assertEqual(branches, expected_return)
def test_identify_mesh_branch_upgrades_n_2(self): expected_return = {102, 103} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=2) self.assertEqual(branches, expected_return)
def test_identify_mesh_branch_upgrades_default(self): # Not enough branches with self.assertRaises(ValueError): _identify_mesh_branch_upgrades(self.mock_scenario)
def test_identify_mesh_branch_upgrades_n_4(self): # Not enough congest branches (barrier cruft values don't count) with self.assertRaises(ValueError): _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=4)
def test_identify_mesh_mean_n_1(self): expected_return = {105} branches = _identify_mesh_branch_upgrades(self.mock_scenario, congestion_metric="mean", upgrade_n=1) self.assertEqual(branches, expected_return)
def test_identify_mesh_mean_n_4_specify_quantile(self): with self.assertRaises(ValueError): _identify_mesh_branch_upgrades(self.mock_scenario, congestion_metric="mean", upgrade_n=4, quantile=0.99)
def test_identify_mesh_mean(self): # Not enough branches with self.assertRaises(ValueError): _identify_mesh_branch_upgrades(self.mock_scenario, congestion_metric="mean")
def test_identify_mesh_MWmiles_n_2(self): # noqa: N802 expected_return = {101, 102} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=2, cost_metric="MWmiles") self.assertEqual(branches, expected_return)
def test_identify_mesh_MW_n_3(self): # noqa: N802 expected_return = {101, 102, 103} branches = _identify_mesh_branch_upgrades(self.mock_scenario, upgrade_n=3, method="MW") self.assertEqual(branches, expected_return)