-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [161] Connect koswat workflow with infrastructures cost export (#…
…167) * chore: Slight refactoring into dataclasses. Added new test to check with/out all types of surroundings * test: Added checks to validate correct generation of summaries. * test: Small test correction * chore: corrections to remove the (unnecessary) use of `math.nan` for costs * chore: Updated dataclass to have no `nan` during initialization * test: Added coverage test to guarantee intialization of default values * test: Added missing coverage tests * chore: processed review remarks
- Loading branch information
Showing
17 changed files
with
314 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/cost_report/infrastructure/test_infrastructure_location_costs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from koswat.cost_report.infrastructure.infrastructure_location_costs import ( | ||
InfrastructureLocationCosts, | ||
) | ||
|
||
|
||
class TestInfrastructureLocationCosts: | ||
def test_initialization(self): | ||
# 1. Initialize class | ||
_infra_location_costs = InfrastructureLocationCosts() | ||
|
||
# 2. Verify expectations. | ||
assert isinstance(_infra_location_costs, InfrastructureLocationCosts) | ||
assert not _infra_location_costs.infrastructure | ||
assert not _infra_location_costs.location | ||
|
||
# Verify default values are not `math.nan``. | ||
# (Otherwise the `.csv` files could become invalid) | ||
assert _infra_location_costs.zone_a == 0 | ||
assert _infra_location_costs.zone_b == 0 | ||
assert _infra_location_costs.zone_a_costs == 0 | ||
assert _infra_location_costs.zone_b_costs == 0 | ||
assert _infra_location_costs.surtax == 0 | ||
assert _infra_location_costs.total_cost == 0 |
23 changes: 23 additions & 0 deletions
23
tests/cost_report/infrastructure/test_infrastructure_location_profile_cost_report.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from koswat.cost_report.cost_report_protocol import CostReportProtocol | ||
from koswat.cost_report.infrastructure.infrastructure_location_profile_cost_report import ( | ||
InfrastructureLocationProfileCostReport, | ||
) | ||
|
||
|
||
class TestInfrastructureLocationProfileCostReport: | ||
def test_initialize(self): | ||
# 1. Define test data. | ||
_report = InfrastructureLocationProfileCostReport( | ||
reinforced_profile=None, | ||
infrastructure=None, | ||
infrastructure_location_costs=None, | ||
) | ||
|
||
# 2. Verify expectations. | ||
assert isinstance(_report, InfrastructureLocationProfileCostReport) | ||
assert isinstance(_report, CostReportProtocol) | ||
|
||
# Verify fallback values. | ||
assert not _report.location | ||
assert _report.total_cost == 0 | ||
assert _report.total_cost_with_surtax == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.