Skip to content

Commit 6f5d8da

Browse files
fmt
1 parent 30f5818 commit 6f5d8da

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

tests/test_grid.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,16 @@ def test_nodes_conversion(input_data):
4343
_, input = input_data
4444
len = input.bus.shape[0]
4545
net, _ = convert_nodes(input)
46+
4647
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"}}}}}}'
4749
assert net.data.iloc[i]["id"] == input.bus.iloc[i]["name"]
4850
assert net.data.iloc[i]["v_rated"] == input.bus.iloc[i]["vn_kv"]
4951
assert net.data.iloc[i]["subnet"] == 101
5052
assert net.data.iloc[i]["operates_from"] is None
5153
assert net.data.iloc[i]["operates_until"] is None
5254
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
5756

5857

5958
def test_line_types_conversion(input_data):
@@ -63,18 +62,11 @@ def test_line_types_conversion(input_data):
6362
net, _ = convert_line_types(input, nodes, node_index_uuid_map)
6463

6564
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"]
7870
assert math.isclose(net.iloc[i]["r"], input.line.iloc[i]["r_ohm_per_km"])
7971
assert math.isclose(net.iloc[i]["x"], input.line.iloc[i]["x_ohm_per_km"])
8072
assert math.isclose(

0 commit comments

Comments
 (0)