Skip to content

Commit

Permalink
test: adds tests for mwmiles with excluded branches
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Aug 26, 2020
1 parent b3c5ff8 commit 2c77648
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions postreise/analyze/transmission/tests/test_mwmiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ def test_calculate_mw_miles_many_scaled(self):
mw_miles = _calculate_mw_miles(self.grid, mock_ct)
self._check_expected_values(mw_miles, expected_mw_miles)

def test_calculate_mw_miles_many_scaled_one_branch_excluded(self):
mock_ct = {"branch": {"branch_id": {11: 2, 12: 3, 13: 1.5, 14: 1.2, 15: 3}}}
expected_mw_miles = {
"mw_miles": 9125.027895725,
"transformer_mw": 123,
"num_lines": 1,
"num_transformers": 3,
}
mw_miles = _calculate_mw_miles(self.grid, mock_ct, exclude_branches={11})
self._check_expected_values(mw_miles, expected_mw_miles)

def test_calculate_mw_miles_many_scaled_two_branches_excluded(self):
mock_ct = {"branch": {"branch_id": {11: 2, 12: 3, 13: 1.5, 14: 1.2, 15: 3}}}
expected_mw_miles = {
"mw_miles": 9125.027895725,
"transformer_mw": 108,
"num_lines": 1,
"num_transformers": 2,
}
mw_miles = _calculate_mw_miles(self.grid, mock_ct, exclude_branches=[11, 13])
self._check_expected_values(mw_miles, expected_mw_miles)


if __name__ == "__main__":
unittest.main()

0 comments on commit 2c77648

Please sign in to comment.