Skip to content

Commit 19686d6

Browse files
committed
test
Signed-off-by: Marcus Koh <marcus.koh@zepben.com>
1 parent 7e4cb0d commit 19686d6

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

test/test_eas_client.py

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from werkzeug import Response
1818
from zepben.ewb.auth import ZepbenTokenFetcher
1919

20-
from zepben.eas import EasClient, Study, SolveConfig, InterventionConfig, YearRange
20+
from zepben.eas import EasClient, Study, SolveConfig, InterventionConfig, YearRange, CandidateGenerationConfig, CandidateGenerationType
2121
from zepben.eas import FeederConfig, ForecastConfig, FixedTimeLoadOverride
2222
from zepben.eas.client.ingestor import IngestorConfigInput, IngestorRunsSortCriteriaInput, IngestorRunsFilterInput, \
2323
IngestorRunState, IngestorRuntimeKind
@@ -1744,3 +1744,53 @@ def test_work_package_config_to_json_includes_server_defaulted_fields_if_specifi
17441744
"dvms": None,
17451745
"allocationLimitPerYear": 5
17461746
}
1747+
1748+
def test_work_package_config_to_json_for_tap_optimization(httpserver: HTTPServer):
1749+
eas_client = EasClient(
1750+
LOCALHOST,
1751+
httpserver.port,
1752+
verify_certificate=False
1753+
)
1754+
1755+
wp_config = WorkPackageConfig(
1756+
name="wp",
1757+
syf_config=FeederConfigs([]),
1758+
intervention=InterventionConfig(
1759+
base_work_package_id="abc",
1760+
year_range=YearRange(2020, 2025),
1761+
intervention_type=InterventionClass.DISTRIBUTION_TAP_OPTIMIZATION,
1762+
allocation_limit_per_year=5,
1763+
candidate_generation=CandidateGenerationConfig(
1764+
type=CandidateGenerationType.TAP_OPTIMIZATION,
1765+
average_voltage_spread_threshold=40,
1766+
voltage_under_limit_hours_threshold=1,
1767+
voltage_over_limit_hours_threshold=2,
1768+
tap_weighting_factor_lower_threshold=-0.3,
1769+
tap_weighting_factor_upper_threshold=0.4
1770+
)
1771+
)
1772+
)
1773+
json_config = eas_client.work_package_config_to_json(wp_config)
1774+
1775+
assert json_config["intervention"] == {
1776+
"baseWorkPackageId": "abc",
1777+
"yearRange": {
1778+
"maxYear": 2025,
1779+
"minYear": 2020
1780+
},
1781+
"interventionType": "DISTRIBUTION_TAP_OPTIMIZATION",
1782+
"candidateGeneration": {
1783+
"type": "TAP_OPTIMIZATION",
1784+
"interventionCriteriaName": None,
1785+
"averageVoltageSpreadThreshold": 40,
1786+
"voltageUnderLimitHoursThreshold": 1,
1787+
"voltageOverLimitHoursThreshold": 2,
1788+
"tapWeightingFactorLowerThreshold": -0.3,
1789+
"tapWeightingFactorUpperThreshold": 0.4,
1790+
},
1791+
"allocationCriteria": None,
1792+
"specificAllocationInstance": None,
1793+
"phaseRebalanceProportions": None,
1794+
"dvms": None,
1795+
"allocationLimitPerYear": 5
1796+
}

0 commit comments

Comments
 (0)