Remove usage of .wrapped_item and some other fixes

This commit is contained in:
Thomas Krijnen
2026-01-10 11:01:18 +01:00
parent 5c9213426f
commit b66b04b001
55 changed files with 129 additions and 118 deletions
@@ -45,7 +45,7 @@ class TestRemoveSurfaceStyleIFC2X3(test.bootstrap.IFC2X3):
# See issue #2046, IfcOpenShell exhibits different behaviour - we can
# remove entity_instances() without an ID if we create them afresh, but
# will segfault if we load them stale.
g = ifcopenshell.file.from_string(self.file.wrapped_data.to_string())
g = ifcopenshell.file.from_string(self.file.to_string())
ifcopenshell.api.style.remove_surface_style(g, style=g.by_type("IfcSurfaceStyleRendering")[0])
assert len(list(g)) == 0
+1 -1
View File
@@ -277,7 +277,7 @@ class TestFile(test.bootstrap.IFC4):
def test_creating_ifc_data_from_a_string(self):
element = self.file.createIfcWall()
g = ifcopenshell.file.from_string(self.file.wrapped_data.to_string())
g = ifcopenshell.file.from_string(self.file.to_string())
assert g.by_id(1).is_a("IfcWall")
def test_assigning_header(self):
@@ -93,9 +93,9 @@ def test_rocks():
assert f[139].RelatingPropertyDefinition.is_a("IfcPropertySetDefinitionSet")
assert {x.id() for x in f[139].RelatingPropertyDefinition[0]} == {136, 138}
b = f.wrapped_data.key_value_store_query("i|139|5")[2:]
b = f.key_value_store_query("i|139|5")[2:]
iden = struct.unpack("Q", b)[0]
b = f.wrapped_data.key_value_store_query(f"t|{iden}|0")[1:]
b = f.key_value_store_query(f"t|{iden}|0")[1:]
assert set(struct.unpack("Q", b[i : i + 8])[0] for i in range(1, len(b), 9)) == {136, 138}
del f
@@ -242,7 +242,7 @@ class TestConvertFileLengthUnits(test.bootstrap.IFC2X3):
ifcopenshell.api.unit.assign_unit(self.file, units=[unit])
output = subject.convert_file_length_units(self.file, target_units="METER")
# there was some renumbering bug in the rocksdb rewrite this statement is to test for that
assert max(i.id() for i in output) == len(output.wrapped_data.entity_names()) + 1
assert max(i.id() for i in output) == len(output.entity_names()) + 1
assert subject.get_full_unit_name(subject.get_project_unit(output, "LENGTHUNIT")) == "METRE"
def test_attribute_conversion(self):