@@ -43,17 +43,16 @@ def test_nodes_conversion(input_data):
43
43
_ , input = input_data
44
44
len = input .bus .shape [0 ]
45
45
net , _ = convert_nodes (input )
46
+
46
47
for i in range (len ):
48
+ coord_string = f'{{"type":"Point","coordinates":[{ input .bus_geodata .iloc [i ]["x" ]} ,{ input .bus_geodata .iloc [i ]["y" ]} ],"crs":{{"type":"name","properties":{{"name":"EPSG:0"}}}}}}'
47
49
assert net .data .iloc [i ]["id" ] == input .bus .iloc [i ]["name" ]
48
50
assert net .data .iloc [i ]["v_rated" ] == input .bus .iloc [i ]["vn_kv" ]
49
51
assert net .data .iloc [i ]["subnet" ] == 101
50
52
assert net .data .iloc [i ]["operates_from" ] is None
51
53
assert net .data .iloc [i ]["operates_until" ] is None
52
54
assert net .data .iloc [i ]["operator" ] is None
53
- assert (
54
- net .data .iloc [i ]["geo_position" ]
55
- == f'{{"type":"Point","coordinates":[{ input .bus_geodata .iloc [i ]["x" ]} ,{ input .bus_geodata .iloc [i ]["y" ]} ],"crs":{{"type":"name","properties":{{"name":"EPSG:0"}}}}}}'
56
- )
55
+ assert net .data .iloc [i ]["geo_position" ] == coord_string
57
56
58
57
59
58
def test_line_types_conversion (input_data ):
@@ -63,18 +62,11 @@ def test_line_types_conversion(input_data):
63
62
net , _ = convert_line_types (input , nodes , node_index_uuid_map )
64
63
65
64
for i in range (len ):
66
- assert (
67
- net .iloc [i ]["v_rated" ]
68
- == nodes .get (node_index_uuid_map .get (input .line .iloc [i ]["from_bus" ]))[
69
- "v_target"
70
- ]
71
- )
72
- assert (
73
- net .iloc [i ]["v_rated" ]
74
- == nodes .get (node_index_uuid_map .get (input .line .iloc [i ]["to_bus" ]))[
75
- "v_target"
76
- ]
77
- )
65
+
66
+ node_from_bus = node_index_uuid_map .get (input .line .iloc [i ]["from_bus" ])
67
+ assert net .iloc [i ]["v_rated" ] == nodes .get (node_from_bus )["v_target" ]
68
+ node_to_bus = node_index_uuid_map .get (input .line .iloc [i ]["to_bus" ])
69
+ assert net .iloc [i ]["v_rated" ] == nodes .get (node_to_bus )["v_target" ]
78
70
assert math .isclose (net .iloc [i ]["r" ], input .line .iloc [i ]["r_ohm_per_km" ])
79
71
assert math .isclose (net .iloc [i ]["x" ], input .line .iloc [i ]["x_ohm_per_km" ])
80
72
assert math .isclose (
0 commit comments