From 1599bc14b3ceb7e41bc097daa53bfb596557a628 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 3 Nov 2025 18:32:54 +0500 Subject: [PATCH] Fix core/test_system.py (5de96c9) --- src/bonsai/bonsai/core/tool.py | 13 +++++++++++++ src/bonsai/test/core/bootstrap.py | 7 +++++++ src/bonsai/test/core/test_system.py | 18 +++++++++++++----- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/bonsai/bonsai/core/tool.py b/src/bonsai/bonsai/core/tool.py index cab08135d9..b611dd29a2 100644 --- a/src/bonsai/bonsai/core/tool.py +++ b/src/bonsai/bonsai/core/tool.py @@ -485,6 +485,19 @@ class Georeference: def xyz2enh(cls, coordinates): pass +@interface +class Group: + def get_group_props(cls): pass + def get_groups_data(cls, group_type): pass + def import_groups(cls, group_type): pass + def enable_group_editing_ui(cls) : pass + def disable_group_editing_ui(cls): pass + def disable_editing_group(cls): pass + def set_active_group_to_edit(cls, group): pass + def toggle_group(cls, group, group_type, option): pass + def update_uilist_index(cls, group_type): pass + + @interface class Ifc: def get(cls): pass diff --git a/src/bonsai/test/core/bootstrap.py b/src/bonsai/test/core/bootstrap.py index 1e25d2efe6..837ce67b94 100644 --- a/src/bonsai/test/core/bootstrap.py +++ b/src/bonsai/test/core/bootstrap.py @@ -107,6 +107,13 @@ def georeference(): prophet.verify() +@pytest.fixture +def group(): + prophet = Prophecy(bonsai.core.tool.Group) + yield prophet + prophet.verify() + + @pytest.fixture def library(): prophet = Prophecy(bonsai.core.tool.Library) diff --git a/src/bonsai/test/core/test_system.py b/src/bonsai/test/core/test_system.py index ae86c7ebe1..d907059b98 100644 --- a/src/bonsai/test/core/test_system.py +++ b/src/bonsai/test/core/test_system.py @@ -18,7 +18,7 @@ import bonsai.core.system as subject -from test.core.bootstrap import ifc, system, spatial +from test.core.bootstrap import ifc, system, spatial, group class TestLoadSystems: @@ -37,10 +37,17 @@ class TestDisableSystemEditingUI: class TestAddSystem: - def test_run(self, ifc, system): + def test_run(self, ifc, group, system): ifc.run("system.add_system", ifc_class="ifc_class").should_be_called() system.import_systems().should_be_called() - subject.add_system(ifc, system, ifc_class="ifc_class") + subject.add_system(ifc, group, system, ifc_class="ifc_class", parent_system=None) + + def test_run_with_parent_system(self, ifc, group, system): + ifc.run("system.add_system", ifc_class="ifc_class").should_be_called().will_return("new_system") + ifc.run("group.assign_group", products=["new_system"], group="parent_system").should_be_called() + group.toggle_group("parent_system", "IfcSystem", "EXPAND").should_be_called() + system.import_systems().should_be_called() + subject.add_system(ifc, group, system, ifc_class="ifc_class", parent_system="parent_system") class TestEditSystem: @@ -53,10 +60,11 @@ class TestEditSystem: class TestRemoveSystem: - def test_run(self, ifc, system): + def test_run(self, ifc, group, system): ifc.run("system.remove_system", system="system").should_be_called() system.import_systems().should_be_called() - subject.remove_system(ifc, system, system="system") + group.update_uilist_index("IfcSystem").should_be_called() + subject.remove_system(ifc, group, system, system="system") class TestEnableEditingSystem: