Skip to content

Commit

Permalink
fix: refactor tests to make them more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPascoli committed Dec 2, 2024
1 parent fbe0046 commit 81ea732
Showing 1 changed file with 0 additions and 204 deletions.
204 changes: 0 additions & 204 deletions tests/integration/study_data_blueprint/test_table_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,207 +966,3 @@ def test_table_type_aliases(client: TestClient, user_access_token: str) -> None:
for table_type in ["area", "link", "cluster", "renewable", "binding constraint"]:
res = client.get(f"/v1/table-schema/{table_type}")
assert res.status_code == 200, f"Failed to get schema for {table_type}: {res.json()}"


def get_table_mode_link_test_data(version: StudyVersion):
"""Generates the JSON data and expected_links based on the version for the link tests"""
if version < STUDY_VERSION_8_2:
json_input = {
"de / fr": {
"colorr": 200,
"colorg": 150,
"colorb": 100,
"displayComments": False,
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 2,
"loopFlow": False,
"transmissionCapacities": "ignore",
},
"es / fr": {
"colorr": 200,
"colorg": 150,
"colorb": 100,
"displayComments": True,
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": True,
},
"fr / it": {
"assetType": "DC", # case-insensitive
},
}

expected_links = {
"de / fr": {
"area1": "de",
"area2": "fr",
"assetType": "ac",
"colorb": 100,
"colorg": 150,
"colorr": 200,
"displayComments": False,
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 2,
"loopFlow": False,
"transmissionCapacities": "ignore",
"usePhaseShifter": False,
},
"de / it": {
"area1": "de",
"area2": "it",
"assetType": "ac",
"colorr": 112,
"colorg": 112,
"colorb": 112,
"displayComments": True,
"hurdlesCost": False,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": False,
},
"es / fr": {
"area1": "es",
"area2": "fr",
"assetType": "ac",
"colorb": 100,
"colorg": 150,
"colorr": 200,
"displayComments": True,
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": True,
},
"fr / it": {
"area1": "fr",
"area2": "it",
"assetType": "dc",
"colorb": 112,
"colorg": 112,
"colorr": 112,
"displayComments": True,
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": False,
},
}
else:
json_input = {
"de / fr": {
"assetType": "ac",
"colorb": 100,
"colorg": 150,
"colorr": 200,
"displayComments": False,
"filterSynthesis": "hourly, daily, weekly, annual",
"filterYearByYear": "hourly, daily, monthly, annual",
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 2,
"loopFlow": False,
"transmissionCapacities": "ignore",
},
"es / fr": {
"assetType": "ac",
"colorb": 100,
"colorg": 150,
"colorr": 200,
"displayComments": True,
"filterSynthesis": "hourly, daily, weekly, monthly, annual, annual", # duplicate is ignored
"filterYearByYear": "hourly, daily, weekly, annual",
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": True,
},
"fr / it": {
"assetType": "DC", # case-insensitive
},
}

expected_links = {
"de / fr": {
"area1": "de",
"area2": "fr",
"assetType": "ac",
"colorb": 100,
"colorg": 150,
"colorr": 200,
"displayComments": False,
"filterSynthesis": "hourly, daily, weekly, annual",
"filterYearByYear": "hourly, daily, monthly, annual",
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 2,
"loopFlow": False,
"transmissionCapacities": "ignore",
"usePhaseShifter": False,
},
"de / it": {
"area1": "de",
"area2": "it",
"assetType": "ac",
"colorr": 112,
"colorg": 112,
"colorb": 112,
"displayComments": True,
"filterSynthesis": "hourly, daily, weekly, monthly, annual",
"filterYearByYear": "hourly, daily, weekly, monthly, annual",
"hurdlesCost": False,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": False,
},
"es / fr": {
"area1": "es",
"area2": "fr",
"assetType": "ac",
"colorb": 100,
"colorg": 150,
"colorr": 200,
"displayComments": True,
"filterSynthesis": "hourly, daily, weekly, monthly, annual",
"filterYearByYear": "hourly, daily, weekly, annual",
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": True,
},
"fr / it": {
"area1": "fr",
"area2": "it",
"assetType": "dc",
"colorb": 112,
"colorg": 112,
"colorr": 112,
"displayComments": True,
"filterSynthesis": "",
"filterYearByYear": "hourly",
"hurdlesCost": True,
"linkStyle": "plain",
"linkWidth": 1,
"loopFlow": False,
"transmissionCapacities": "enabled",
"usePhaseShifter": False,
},
}

return json_input, expected_links

0 comments on commit 81ea732

Please sign in to comment.