22#
33# SPDX-License-Identifier: MPL-2.0
44
5- from dataclasses import dataclass
65
76import numpy as np
87import pytest
1918)
2019from power_grid_model_ds ._core .model .grids .base import Grid
2120from tests .fixtures .arrays import ExtendedLineArray , ExtendedNodeArray
21+ from tests .fixtures .grid_classes import ExtendedGrid
2222from tests .unit .model .grids .test_custom_grid import CustomGrid
2323
2424# pylint: disable=missing-function-docstring,missing-class-docstring
2525
26- def test_load_flow_on_random ():
27- """Tests the power flow on a randomly configured grid"""
28- grid_generator = RadialGridGenerator (grid_class = Grid , nr_nodes = 5 , nr_sources = 1 , nr_nops = 0 )
29- grid = grid_generator .run (seed = 0 )
26+
27+ class TestCalculatePowerFlow :
28+ def test_load_flow_on_random_grid (self ):
29+ """Tests the power flow on a randomly configured grid"""
30+ grid_generator = RadialGridGenerator (grid_class = Grid , nr_nodes = 5 , nr_sources = 1 , nr_nops = 0 )
31+ grid = grid_generator .run (seed = 0 )
3032
3133 core_interface = PowerGridModelInterface (grid = grid )
3234 core_interface .create_input_from_grid ()
@@ -183,11 +185,6 @@ class CustomNodeArrayDefault(NodeArray):
183185 _defaults = {"extra_field" : 0 }
184186
185187
186- @dataclass
187- class CustomGridDefault (Grid ):
188- node : CustomNodeArrayDefault
189-
190-
191188class TestCreateGridFromInputData :
192189 def test_create_grid_from_input_data (self , input_data_pgm ):
193190 core_interface = PowerGridModelInterface (input_data = input_data_pgm )
@@ -290,14 +287,14 @@ def test_create_grid_from_input_data(self, input_data_pgm):
290287 )
291288
292289 def test_create_extended_grid_with_default_from_input_data (self , input_data_pgm ):
293- grid = CustomGridDefault .empty ()
290+ grid = ExtendedGrid .empty ()
294291
295292 core_interface = PowerGridModelInterface (grid = grid , input_data = input_data_pgm )
296293
297294 output = core_interface .create_grid_from_input_data ()
298295
299- assert isinstance (grid , CustomGridDefault )
300- assert isinstance (grid .node , CustomNodeArrayDefault )
296+ assert isinstance (grid , ExtendedGrid )
297+ assert isinstance (grid .node , ExtendedNodeArray )
301298 assert np .array_equal (
302299 output .node .data ,
303300 np .array (
@@ -312,7 +309,7 @@ def test_create_extended_grid_with_default_from_input_data(self, input_data_pgm)
312309 ("node_type" , "i1" ),
313310 ("feeder_branch_id" , "<i4" ),
314311 ("feeder_node_id" , "<i4" ),
315- ("extra_field " , "<i8 " ),
312+ ("u " , "<f8 " ),
316313 ],
317314 ),
318315 )
0 commit comments