@@ -197,15 +197,15 @@ def test_fill_pgm_extra_info():
197197def test_fill_pp_extra_info ():
198198 # Arrange
199199 converter = PandaPowerConverter ()
200- converter .idx_lookup [(ComponentType . line , None )] = pd .Series ([102 , 103 ], index = [1 , 2 ])
200+ converter .idx_lookup [(" line" , None )] = pd .Series ([102 , 103 ], index = [1 , 2 ])
201201 converter .idx_lookup [("trafo" , None )] = pd .Series ([201 , 202 , 203 ], index = [3 , 4 , 5 ])
202- converter .idx [(ComponentType . line , None )] = pd .Series ([1 , 2 ], index = [102 , 103 ])
202+ converter .idx [(" line" , None )] = pd .Series ([1 , 2 ], index = [102 , 103 ])
203203 converter .idx [("trafo" , None )] = pd .Series ([3 , 4 , 5 ], index = [201 , 202 , 203 ])
204204
205205 converter .pp_input_data ["trafo" ] = pd .DataFrame (
206206 {"df" : [0.1 , 0.2 , 0.3 ], "other" : [0.1 , 0.2 , 0.3 ]}, index = [201 , 202 , 203 ]
207207 )
208- converter .pp_input_data [ComponentType . line ] = pd .DataFrame ([10 , 11 , 12 ], columns = ["df" ], index = [201 , 202 , 203 ])
208+ converter .pp_input_data [" line" ] = pd .DataFrame ([10 , 11 , 12 ], columns = ["df" ], index = [201 , 202 , 203 ])
209209
210210 # Act
211211 extra_info = {}
@@ -500,16 +500,16 @@ def test_create_pgm_input_nodes(mock_init_array: MagicMock, two_pp_objs: MockDf,
500500@patch ("power_grid_model_io.converters.pandapower_converter.initialize_array" )
501501def test_create_pgm_input_lines (mock_init_array : MagicMock , two_pp_objs , converter ):
502502 # Arrange
503- converter .pp_input_data [ComponentType . line ] = two_pp_objs
503+ converter .pp_input_data [" line" ] = two_pp_objs
504504
505505 # Act
506506 converter ._create_pgm_input_lines ()
507507
508508 # Assert
509509
510510 # administration
511- converter .get_switch_states .assert_called_once_with (ComponentType . line )
512- converter ._generate_ids .assert_called_once_with (ComponentType . line , two_pp_objs .index )
511+ converter .get_switch_states .assert_called_once_with (" line" )
512+ converter ._generate_ids .assert_called_once_with (" line" , two_pp_objs .index )
513513 converter ._get_pgm_ids .assert_any_call ("bus" , _get_pp_attr ("line" , "from_bus" , expected_type = "u4" ))
514514 converter ._get_pgm_ids .assert_any_call ("bus" , _get_pp_attr ("line" , "to_bus" , expected_type = "u4" ))
515515
@@ -671,7 +671,9 @@ def test_create_pgm_input_sym_loads(mock_init_array: MagicMock, two_pp_objs, con
671671 # administration:
672672
673673 # initialization
674- mock_init_array .assert_called_once_with (data_type = DatasetType .input , component_type = ComponentType .sym_load , shape = 3 * 2 )
674+ mock_init_array .assert_called_once_with (
675+ data_type = DatasetType .input , component_type = ComponentType .sym_load , shape = 3 * 2
676+ )
675677
676678 # retrieval:
677679 converter ._get_pp_attr .assert_any_call ("load" , "bus" , expected_type = "u4" )
@@ -708,7 +710,9 @@ def test_create_pgm_input_asym_loads(mock_init_array: MagicMock, two_pp_objs, co
708710 converter ._generate_ids .assert_called_once_with ("asymmetric_load" , two_pp_objs .index )
709711
710712 # initialization
711- mock_init_array .assert_called_once_with (data_type = DatasetType .input , component_type = ComponentType .asym_load , shape = 2 )
713+ mock_init_array .assert_called_once_with (
714+ data_type = DatasetType .input , component_type = ComponentType .asym_load , shape = 2
715+ )
712716
713717 # retrieval:
714718 converter ._get_pp_attr .assert_any_call ("asymmetric_load" , "bus" , expected_type = "u4" )
@@ -790,7 +794,7 @@ def test_create_pgm_input_transformers__tap_dependent_impedance() -> None:
790794@patch ("power_grid_model_io.converters.pandapower_converter.initialize_array" )
791795def test_create_pgm_input_shunts (mock_init_array : MagicMock , two_pp_objs , converter ):
792796 # Arrange
793- converter .pp_input_data [ComponentType . shunt ] = two_pp_objs
797+ converter .pp_input_data [" shunt" ] = two_pp_objs
794798
795799 # Act
796800 converter ._create_pgm_input_shunts ()
@@ -804,12 +808,12 @@ def test_create_pgm_input_shunts(mock_init_array: MagicMock, two_pp_objs, conver
804808 mock_init_array .assert_called_once_with (data_type = DatasetType .input , component_type = ComponentType .shunt , shape = 2 )
805809
806810 # retrieval:
807- converter ._get_pp_attr .assert_any_call (ComponentType . shunt , "bus" , expected_type = "u4" )
808- converter ._get_pp_attr .assert_any_call (ComponentType . shunt , "p_mw" , expected_type = "f8" )
809- converter ._get_pp_attr .assert_any_call (ComponentType . shunt , "q_mvar" , expected_type = "f8" )
810- converter ._get_pp_attr .assert_any_call (ComponentType . shunt , "vn_kv" , expected_type = "f8" )
811- converter ._get_pp_attr .assert_any_call (ComponentType . shunt , "step" , expected_type = "u4" , default = 1 )
812- converter ._get_pp_attr .assert_any_call (ComponentType . shunt , "in_service" , expected_type = "bool" , default = True )
811+ converter ._get_pp_attr .assert_any_call (" shunt" , "bus" , expected_type = "u4" )
812+ converter ._get_pp_attr .assert_any_call (" shunt" , "p_mw" , expected_type = "f8" )
813+ converter ._get_pp_attr .assert_any_call (" shunt" , "q_mvar" , expected_type = "f8" )
814+ converter ._get_pp_attr .assert_any_call (" shunt" , "vn_kv" , expected_type = "f8" )
815+ converter ._get_pp_attr .assert_any_call (" shunt" , "step" , expected_type = "u4" , default = 1 )
816+ converter ._get_pp_attr .assert_any_call (" shunt" , "in_service" , expected_type = "bool" , default = True )
813817
814818 assert len (converter ._get_pp_attr .call_args_list ) == 6
815819
@@ -868,7 +872,9 @@ def test_create_pgm_input_transformers(mock_init_array: MagicMock, two_pp_objs,
868872 )
869873
870874 # initialization
871- mock_init_array .assert_called_once_with (data_type = DatasetType .input , component_type = ComponentType .transformer , shape = 2 )
875+ mock_init_array .assert_called_once_with (
876+ data_type = DatasetType .input , component_type = ComponentType .transformer , shape = 2
877+ )
872878
873879 # retrieval:
874880 converter ._get_pp_attr .assert_any_call ("trafo" , "hv_bus" , expected_type = "u4" )
@@ -1581,7 +1587,9 @@ def test_create_pgm_input_wards(mock_init_array: MagicMock, two_pp_objs, convert
15811587 # administration:
15821588
15831589 # initialization
1584- mock_init_array .assert_called_once_with (data_type = DatasetType .input , component_type = ComponentType .sym_load , shape = 2 * 2 )
1590+ mock_init_array .assert_called_once_with (
1591+ data_type = DatasetType .input , component_type = ComponentType .sym_load , shape = 2 * 2
1592+ )
15851593
15861594 # retrieval:
15871595 converter ._get_pp_attr .assert_any_call ("ward" , "bus" , expected_type = "u4" )
@@ -2034,7 +2042,7 @@ def test_get_switch_states_lines(mock_get_individual_switch_states: MagicMock):
20342042 # Arrange
20352043 converter = PandaPowerConverter ()
20362044 converter .pp_input_data = {
2037- ComponentType . line : pd .DataFrame (columns = ["from_bus" , "to_bus" ], data = [[101 , 102 ]], index = [1 ]),
2045+ " line" : pd .DataFrame (columns = ["from_bus" , "to_bus" ], data = [[101 , 102 ]], index = [1 ]),
20382046 "switch" : pd .DataFrame (
20392047 columns = ["bus" , "et" , "element" , "closed" ],
20402048 data = [[101 , "l" , 1 , False ], [102 , "x" , 1 , False ]],
@@ -2108,7 +2116,7 @@ def test_get_switch_states__exception():
21082116
21092117 # Act / Assert
21102118 with pytest .raises (KeyError , match = r"link" ):
2111- converter .get_switch_states (ComponentType . link )
2119+ converter .get_switch_states (" link" )
21122120
21132121
21142122@patch ("power_grid_model_io.converters.pandapower_converter.PandaPowerConverter.get_individual_switch_states" )
@@ -2138,11 +2146,11 @@ def test_lookup_id():
21382146 # Arrange
21392147 converter = PandaPowerConverter ()
21402148 converter .idx_lookup = {
2141- (ComponentType . line , None ): pd .Series ([0 , 1 , 2 , 3 , 4 ], index = [21 , 345 , 0 , 3 , 15 ]),
2149+ (" line" , None ): pd .Series ([0 , 1 , 2 , 3 , 4 ], index = [21 , 345 , 0 , 3 , 15 ]),
21422150 ("load" , "const_current" ): pd .Series ([5 , 6 , 7 , 8 , 9 ], index = [543 , 14 , 34 , 48 , 4 ]),
21432151 }
21442152
2145- expected_line = {"table" : ComponentType . line , "index" : 4 }
2153+ expected_line = {"table" : " line" , "index" : 4 }
21462154 expected_load = {"table" : "load" , "name" : "const_current" , "index" : 8 }
21472155
21482156 # Act
@@ -2157,7 +2165,7 @@ def test_lookup_id():
21572165def test_lookup_id__value_error ():
21582166 # Arrange
21592167 converter = PandaPowerConverter ()
2160- converter .idx_lookup = {(ComponentType . line , None ): pd .Series ([0 , 1 , 2 , 3 , 4 ], index = [21 , 345 , 0 , 3 , 15 ])}
2168+ converter .idx_lookup = {(" line" , None ): pd .Series ([0 , 1 , 2 , 3 , 4 ], index = [21 , 345 , 0 , 3 , 15 ])}
21612169
21622170 # Act / Assert
21632171 with pytest .raises (KeyError ):
0 commit comments