mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Handle null Styles when loading surface styles
An IfcSurfaceStyle with a NULL Styles set raised a TypeError when loading a project. Guard the iterations, matching the existing defensive pattern in import_presentation_styles. Generated with the assistance of an AI coding tool.
This commit is contained in:
committed by
Cyril Waechter
parent
ff2b57d152
commit
243f0f32dc
@@ -393,6 +393,19 @@ class TestGetUVMaps(NewFile):
|
||||
assert subject.get_uv_maps(representation) == [uv_map]
|
||||
|
||||
|
||||
class TestGetStyleElements(NewFile):
|
||||
def test_style_with_null_styles(self):
|
||||
style = ifcopenshell.file().create_entity("IfcSurfaceStyle", "Name", "BOTH", None)
|
||||
assert subject.get_style_elements(style) == {}
|
||||
|
||||
def test_material_with_null_styles(self):
|
||||
tool.Ifc.set(ifc := ifcopenshell.file())
|
||||
style = ifc.create_entity("IfcSurfaceStyle", "Name", "BOTH", None)
|
||||
material = bpy.data.materials.new("Material")
|
||||
tool.Ifc.link(style, material)
|
||||
assert subject.get_style_elements(material) == {}
|
||||
|
||||
|
||||
class TestImportSurfaceAttributes(NewFile):
|
||||
def test_run(self):
|
||||
tool.Ifc.set(ifc := ifcopenshell.file())
|
||||
|
||||
Reference in New Issue
Block a user