Skip to content

Commit 2407b18

Browse files
committed
change input type
Signed-off-by: zhen0427 <[email protected]>
1 parent b1ed926 commit 2407b18

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/power_grid_model_io/converters/pgm_json_converter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from typing import Any, Dict, List, Optional, Union
1414

1515
import numpy as np
16-
from power_grid_model import DatasetType, initialize_array
16+
from power_grid_model import initialize_array, DatasetType, ComponentType
1717
from power_grid_model.data_types import ComponentList, Dataset, SingleDataset, SinglePythonDataset
1818
from power_grid_model.utils import json_deserialize, json_serialize
1919

@@ -93,7 +93,7 @@ def _parse_data(self, data: StructuredData, data_type: DatasetType, extra_info:
9393
return result
9494

9595
def _parse_dataset(
96-
self, data: SinglePythonDataset, data_type: Enum, extra_info: Optional[ExtraInfo]
96+
self, data: SinglePythonDataset, data_type: DatasetType, extra_info: Optional[ExtraInfo]
9797
) -> SingleDataset:
9898
"""This function parses a single Python dataset and returns a power-grid-model input or update dictionary
9999
@@ -120,7 +120,7 @@ def _parse_dataset(
120120

121121
@staticmethod
122122
def _parse_component(
123-
objects: ComponentList, component: Enum, data_type: Enum, extra_info: Optional[ExtraInfo]
123+
objects: ComponentList, component: ComponentType, data_type: DatasetType, extra_info: Optional[ExtraInfo]
124124
) -> np.ndarray:
125125
"""This function generates a structured numpy array (power-grid-model native) from a structured dataset
126126

tests/unit/converters/test_pandapower_converter_input.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ def test_fill_pgm_extra_info():
180180
assert extra_info[2] == {"id_reference": {"table": "bus", "index": 103}}
181181
assert extra_info[3] == {
182182
"id_reference": {"table": "load", "name": "const_current", "index": 201},
183-
"pgm_input": {"node": 0},
183+
"pgm_input": {ComponentType.node: 0},
184184
}
185185
assert extra_info[4] == {
186186
"id_reference": {"table": "load", "name": "const_current", "index": 202},
187-
"pgm_input": {"node": 1},
187+
"pgm_input": {ComponentType.node: 1},
188188
}
189189
assert extra_info[5] == {
190190
"id_reference": {"table": "load", "name": "const_current", "index": 203},
191-
"pgm_input": {"node": 2},
191+
"pgm_input": {ComponentType.node: 2},
192192
}
193193
assert extra_info[6] == {"pgm_input": {"from_node": 0, "to_node": 1, "i_n": 106.0}}
194194
assert extra_info[7] == {"pgm_input": {"from_node": 1, "to_node": 2, "i_n": 105.0}}

0 commit comments

Comments
 (0)