Implement attribute facet for IDS

This commit is contained in:
Dion Moult
2022-05-10 16:23:07 +10:00
parent 12e7ed356c
commit 083d9d3e3e
2 changed files with 86 additions and 0 deletions
+23
View File
@@ -152,11 +152,34 @@ class TestIdsAuthoring(unittest.TestCase):
"""Creating basic IDS"""
def test_creating_a_minimal_ids_and_validating(self):
specs = ids.ids(title="Title")
spec = ids.specification(name="Name")
spec.add_applicability(ids.entity.create(name="IfcWall"))
spec.add_requirement(ids.attribute.create(name="Name", value="Waldo"))
specs.specifications.append(spec)
assert "http://standards.buildingsmart.org/IDS" in specs.to_string()
model = ifcopenshell.file()
model.createIfcWall(Name="Waldo")
specs.validate(model)
# TODO test this without resorting to hooking into logger output
def test_entity_create(self):
e = ids.entity.create(name="Test_Name", predefinedType="Test_PredefinedType")
self.assertEqual(e.name, "Test_Name")
self.assertEqual(e.predefinedType, "Test_PredefinedType")
def test_attribute_create(self):
attribute = ids.attribute.create(name="Name", value="Value")
assert attribute.name == "Name"
assert attribute.value == "Value"
assert attribute.asdict() == {
"name": {"simpleValue": "Name"},
"value": {"simpleValue": "Value"},
"@location": "any",
}
def test_classification_create(self):
c = ids.classification.create(location="any", value="Test_Value", system="Test_System")
self.assertEqual(c.location, "any")