Run black on IOS-Python

This commit is contained in:
Dion Moult
2024-07-26 12:00:28 +10:00
parent d51fa2c5f7
commit a6286293d8
83 changed files with 603 additions and 637 deletions
@@ -379,23 +379,17 @@ class TestGetMaterial(test.bootstrap.IFC4):
def test_getting_a_material_layer_set_of_a_product(self):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
rel = ifcopenshell.api.material.assign_material(
self.file, products=[element], type="IfcMaterialLayerSet"
)
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialLayerSet")
assert subject.get_material(element) == rel.RelatingMaterial
def test_getting_a_material_profile_set_of_a_product(self):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
rel = ifcopenshell.api.material.assign_material(
self.file, products=[element], type="IfcMaterialProfileSet"
)
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialProfileSet")
assert subject.get_material(element) == rel.RelatingMaterial
def test_getting_a_material_layer_set_usage_of_a_product(self):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
rel = ifcopenshell.api.material.assign_material(
self.file, products=[element], type="IfcMaterialLayerSetUsage"
)
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialLayerSetUsage")
assert subject.get_material(element) == rel.RelatingMaterial
def test_getting_a_material_profile_set_usage_of_a_product(self):
@@ -407,9 +401,7 @@ class TestGetMaterial(test.bootstrap.IFC4):
def test_getting_a_material_layer_set_indirectly_from_an_assigned_usage(self):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
rel = ifcopenshell.api.material.assign_material(
self.file, products=[element], type="IfcMaterialLayerSetUsage"
)
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialLayerSetUsage")
assert subject.get_material(element, should_skip_usage=True) == rel.RelatingMaterial.ForLayerSet
def test_getting_a_material_profile_set_indirectly_from_an_assigned_usage(self):
@@ -501,9 +493,7 @@ class TestGetStyles(test.bootstrap.IFC4):
self.file, context=body, length=5, height=3, thickness=0.118
)
ifcopenshell.api.geometry.assign_representation(
self.file, product=element, representation=representation
)
ifcopenshell.api.geometry.assign_representation(self.file, product=element, representation=representation)
ifcopenshell.api.style.assign_representation_styles(
self.file, shape_representation=representation, styles=[style2]
)
@@ -540,9 +530,7 @@ class TestGetElementsByMaterial(test.bootstrap.IFC4):
material_set = ifcopenshell.api.material.add_material_set(self.file, set_type="IfcMaterialProfileSet")
ifcopenshell.api.material.add_profile(self.file, profile_set=material_set, material=material)
ifcopenshell.api.material.assign_material(self.file, products=[element_type], material=material_set)
ifcopenshell.api.material.assign_material(
self.file, products=[element], type="IfcMaterialProfileSetUsage"
)
ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialProfileSetUsage")
usage = self.file.by_type("IfcMaterialProfileSetUsage")[0]
assert subject.get_elements_by_material(self.file, material) == {element, element_type}
assert subject.get_elements_by_material(self.file, material_set) == {element, element_type}
@@ -551,9 +539,7 @@ class TestGetElementsByMaterial(test.bootstrap.IFC4):
def test_getting_elements_of_a_material_constituent_set(self):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
material = ifcopenshell.api.material.add_material(self.file)
material_set = ifcopenshell.api.material.add_material_set(
self.file, set_type="IfcMaterialConstituentSet"
)
material_set = ifcopenshell.api.material.add_material_set(self.file, set_type="IfcMaterialConstituentSet")
ifcopenshell.api.material.add_constituent(self.file, constituent_set=material_set, material=material)
ifcopenshell.api.material.assign_material(self.file, products=[element], material=material_set)
assert subject.get_elements_by_material(self.file, material) == {element}
@@ -57,7 +57,7 @@ class TestPsetQto:
assert "Pset_FurnitureTypeTable" in names
names = self.pset_qto.get_applicable_names("IfcFurnitureType", "TABLE")
assert "Pset_FurnitureTypeTable" in names
names = self.pset_qto.get_applicable_names("IfcFurnitureType" )
names = self.pset_qto.get_applicable_names("IfcFurnitureType")
names2 = self.pset_qto.get_applicable_names("IfcFurnitureType", "CUSTOM")
assert names == names2
@@ -86,9 +86,7 @@ class TestGetElementValue(test.bootstrap.IFC4):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
material = ifcopenshell.api.material.add_material(self.file, name="CON01")
material2 = ifcopenshell.api.material.add_material(self.file, name="CON02")
material_set = ifcopenshell.api.material.add_material_set(
self.file, name="FOO", set_type="IfcMaterialLayerSet"
)
material_set = ifcopenshell.api.material.add_material_set(self.file, name="FOO", set_type="IfcMaterialLayerSet")
layer = ifcopenshell.api.material.add_layer(self.file, layer_set=material_set, material=material)
layer.Name = "L1"
layer = ifcopenshell.api.material.add_layer(self.file, layer_set=material_set, material=material)
@@ -113,9 +111,7 @@ class TestGetElementValue(test.bootstrap.IFC4):
element = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
material = ifcopenshell.api.material.add_material(self.file, name="CON01")
material2 = ifcopenshell.api.material.add_material(self.file, name="CON02")
material_set = ifcopenshell.api.material.add_material_set(
self.file, name="FOO", set_type="IfcMaterialLayerSet"
)
material_set = ifcopenshell.api.material.add_material_set(self.file, name="FOO", set_type="IfcMaterialLayerSet")
layer = ifcopenshell.api.material.add_layer(self.file, layer_set=material_set, material=material)
layer.Name = "L1"
ifcopenshell.api.material.assign_material(self.file, products=[element], material=material_set)
@@ -151,6 +151,7 @@ class TestConvertFileLengthUnits(test.bootstrap.IFC4):
unit_assignment = subject.get_unit_assignment(output)
assert len(unit_assignment.Units) == 1
class TestConvertFileLengthUnitsIFC2X3(test.bootstrap.IFC2X3):
def test_converting_map_conversion_if_there_is_no_map_unit(self):
ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcProject")
@@ -171,7 +172,9 @@ class TestConvertFileLengthUnitsIFC2X3(test.bootstrap.IFC2X3):
ifcopenshell.api.context.add_context(self.file, "Model")
ifcopenshell.api.georeference.add_georeferencing(self.file)
ifcopenshell.api.georeference.edit_georeferencing(
self.file, projected_crs={"MapUnit": subject.get_full_unit_name(meter)}, coordinate_operation={"Eastings": 10, "Scale": 0.001}
self.file,
projected_crs={"MapUnit": subject.get_full_unit_name(meter)},
coordinate_operation={"Eastings": 10, "Scale": 0.001},
)
ifcopenshell.api.unit.assign_unit(self.file, units=[unit])
output = subject.convert_file_length_units(self.file, target_units="METER")