From d875ea2b3a943ca19649fbefff548146a3d1d155 Mon Sep 17 00:00:00 2001 From: Roman Bolgaryn Date: Tue, 2 Apr 2024 17:23:22 +0200 Subject: [PATCH] added failing test for select_subnet with switch results --- CHANGELOG.rst | 1 + pandapower/test/toolbox/test_grid_modification.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c7cafd1c4..a526cdd62 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,7 @@ Change Log [upcoming release] - 2024-..-.. ------------------------------- +- [FIXED] handling of switch results in :code:`pp.toolbox.select_subnet` [2.14.6] - 2024-04-02 ------------------------------- diff --git a/pandapower/test/toolbox/test_grid_modification.py b/pandapower/test/toolbox/test_grid_modification.py index 6626ab304..3c6b7589d 100644 --- a/pandapower/test/toolbox/test_grid_modification.py +++ b/pandapower/test/toolbox/test_grid_modification.py @@ -245,6 +245,15 @@ def test_select_subnet(): subnet = pp.select_subnet(net2, buses | elements) assert net2.switch[net2.switch.et == 'b'].index.isin(subnet.switch.index).all() + pp.runpp(net2) + net3 = pp.select_subnet(net2, [0, 1], include_results=True) + assert len(net3.res_switch) > 0 + assert net3.switch.index.equals(net3.res_switch.index) + + net3 = pp.select_subnet(net2, [0, 1], include_results=True, keep_everything_else=True) + assert len(net3.res_switch) > 0 + assert net3.switch.index.equals(net3.res_switch.index) + def test_add_zones_to_elements(): net = nw.create_cigre_network_mv()