From 46bee8aed9b453a1f439b8d09938a500681ffa9e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 28 Feb 2024 11:36:30 +0500 Subject: [PATCH] fix errors in tests they were failing because import_reference_attributes were failing to get docs for unset schema version since ifc file wasn't attached to Blender --- src/blenderbim/test/tool/test_library.py | 4 ++-- src/blenderbim/test/tool/test_style.py | 4 ++-- src/blenderbim/test/tool/test_unit.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/blenderbim/test/tool/test_library.py b/src/blenderbim/test/tool/test_library.py index 0f254f6a29..2e8915eee0 100644 --- a/src/blenderbim/test/tool/test_library.py +++ b/src/blenderbim/test/tool/test_library.py @@ -75,7 +75,7 @@ class TestGetActiveReference(NewFile): class TestImportLibraryAttributes(NewFile): def test_run(self): - ifc = ifcopenshell.file() + tool.Ifc.set(ifc := ifcopenshell.file()) library = ifc.createIfcLibraryInformation("Name", "Version", None, "VersionDate", "Location", "Description") subject.import_library_attributes(library) props = bpy.context.scene.BIMLibraryProperties @@ -88,7 +88,7 @@ class TestImportLibraryAttributes(NewFile): class TestImportReferenceAttributes(NewFile): def test_run(self): - ifc = ifcopenshell.file() + tool.Ifc.set(ifc := ifcopenshell.file()) reference = ifc.createIfcLibraryReference("Location", "Identification", "Name", "Description", "Language") subject.import_reference_attributes(reference) props = bpy.context.scene.BIMLibraryProperties diff --git a/src/blenderbim/test/tool/test_style.py b/src/blenderbim/test/tool/test_style.py index 0f821cc5ab..ab1f24a949 100644 --- a/src/blenderbim/test/tool/test_style.py +++ b/src/blenderbim/test/tool/test_style.py @@ -392,7 +392,7 @@ class TestGetUVMaps(NewFile): class TestImportSurfaceAttributes(NewFile): def test_run(self): - ifc = ifcopenshell.file() + tool.Ifc.set(ifc := ifcopenshell.file()) style = ifc.createIfcSurfaceStyle("Name", "BOTH") obj = bpy.data.materials.new("Material") subject.import_surface_attributes(style, obj) @@ -400,7 +400,7 @@ class TestImportSurfaceAttributes(NewFile): assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH" def test_importing_surface_attributes_twice(self): - ifc = ifcopenshell.file() + tool.Ifc.set(ifc := ifcopenshell.file()) style = ifc.createIfcSurfaceStyle("Name", "BOTH") obj = bpy.data.materials.new("Material") subject.import_surface_attributes(style, obj) diff --git a/src/blenderbim/test/tool/test_unit.py b/src/blenderbim/test/tool/test_unit.py index 3e6aa99220..9a256bfccc 100644 --- a/src/blenderbim/test/tool/test_unit.py +++ b/src/blenderbim/test/tool/test_unit.py @@ -154,7 +154,7 @@ class TestGetSceneUnitSIPrefix: class TestImportUnitAttributes(NewFile): def test_importing_derived_units(self): - ifc = ifcopenshell.file() + tool.Ifc.set(ifc := ifcopenshell.file()) unit = ifc.createIfcDerivedUnit() unit.UnitType = "ANGULARVELOCITYUNIT" unit.UserDefinedType = "UserDefinedType" @@ -164,7 +164,7 @@ class TestImportUnitAttributes(NewFile): assert props.unit_attributes.get("UserDefinedType").string_value == "UserDefinedType" def test_importing_monetary_units(self): - ifc = ifcopenshell.file() + tool.Ifc.set(ifc := ifcopenshell.file()) unit = ifc.createIfcMonetaryUnit() unit.Currency = "Currency" subject.import_unit_attributes(unit) @@ -172,7 +172,7 @@ class TestImportUnitAttributes(NewFile): assert props.unit_attributes.get("Currency").string_value == "Currency" def test_importing_monetary_units_ifc2x3(self): - ifc = ifcopenshell.file(schema="IFC2X3") + tool.Ifc.set(ifc := ifcopenshell.file(schema="IFC2X3")) unit = ifc.createIfcMonetaryUnit() unit.Currency = "USD" subject.import_unit_attributes(unit)