Fix #2274. You can now purge unused types.

This commit is contained in:
Dion Moult
2023-02-13 15:20:56 +11:00
parent 7d979e5a04
commit 007d984baf
11 changed files with 109 additions and 9 deletions
+1 -2
View File
@@ -124,6 +124,5 @@ class TestSelectSimilarContainer:
ifc.get_entity("obj").should_be_called().will_return("element")
spatial.get_container("element").should_be_called().will_return("container")
spatial.get_decomposed_elements("container").should_be_called().will_return(["contained_element"])
ifc.get_object("contained_element").should_be_called().will_return("contained_obj")
spatial.select_object("contained_obj").should_be_called()
spatial.select_products(["contained_element"]).should_be_called()
subject.select_similar_container(ifc, spatial, obj="obj")
+11
View File
@@ -39,3 +39,14 @@ class TestAssignType:
ifc.get_object("element").should_be_called().will_return("obj")
type.disable_editing("obj").should_be_called()
subject.assign_type(ifc, type, element="element", type="type")
class TestPurgeUnusedTypes:
def test_run(self, ifc, type):
type.get_model_types().should_be_called().will_return(["element_type"])
type.get_type_occurrences("element_type").should_be_called().will_return([])
ifc.run("root.remove_product", product="element_type").should_be_called()
ifc.get_object("element_type").should_be_called().will_return("obj")
ifc.unlink(obj="obj").should_be_called()
type.remove_object("obj").should_be_called()
subject.purge_unused_types(ifc, type)