fix error purging unused types in 75f8e75

This commit is contained in:
Andrej730
2024-07-30 19:08:52 +05:00
parent 51463ab674
commit de0374bdbd
6 changed files with 18 additions and 24 deletions
+11 -6
View File
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.core.type as subject
from test.core.bootstrap import ifc, type
from test.core.bootstrap import ifc, type, geometry
class TestAssignType:
@@ -42,11 +42,16 @@ class TestAssignType:
class TestPurgeUnusedTypes:
def test_run(self, ifc, type):
def test_purge_types_obj_found(self, ifc, type, geometry):
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(element="element_type").should_be_called()
type.remove_object("obj").should_be_called()
subject.purge_unused_types(ifc, type)
geometry.delete_ifc_object("obj").should_be_called()
subject.purge_unused_types(ifc, type, geometry)
def test_purge_types_obj_not_found(self, ifc, type, geometry):
type.get_model_types().should_be_called().will_return(["element_type"])
type.get_type_occurrences("element_type").should_be_called().will_return([])
ifc.get_object("element_type").should_be_called().will_return(None)
ifc.run("root.remove_product", product="element_type").should_be_called()
subject.purge_unused_types(ifc, type, geometry)
-7
View File
@@ -168,13 +168,6 @@ class TestHasMaterialUsage(NewFile):
assert subject.has_material_usage(element) is True
class TestRemoveObject(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
subject.remove_object(obj)
assert not bpy.data.objects.get("Object")
class TestRunGeometryAddRepresentation(NewFile):
def test_nothing(self):
pass