mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
added new tests for case where spec has no requirements
This commit is contained in:
@@ -250,3 +250,43 @@ class TestSpecification:
|
||||
"applicability": {},
|
||||
"requirements": {},
|
||||
}
|
||||
|
||||
def test_specification_has_no_requirements(self):
|
||||
model = ifcopenshell.file()
|
||||
wall = model.createIfcWall()
|
||||
waldo = model.createIfcWall(Name="Waldo")
|
||||
|
||||
test_ids = ids.Ids(title="Title")
|
||||
spec = ids.Specification(name="Name")
|
||||
spec.applicability.append(ids.Entity(name="IFCWALL"))
|
||||
test_ids.specifications.append(spec)
|
||||
spec.minOccurs = 1
|
||||
run("A specification that is required and has at least one applicable entity but no requirements shall pass", test_ids, model, True, [wall, waldo], None)
|
||||
|
||||
test_ids = ids.Ids(title="Title")
|
||||
spec = ids.Specification(name="Name")
|
||||
test_ids.specifications.append(spec)
|
||||
spec.minOccurs = 1
|
||||
run("A specification that is required but has no applicable entities or requirements shall fail", test_ids, model, False, None, None)
|
||||
|
||||
test_ids = ids.Ids(title="Title")
|
||||
spec = ids.Specification(name="Name")
|
||||
spec.applicability.append(ids.Entity(name="IFCWALL"))
|
||||
test_ids.specifications.append(spec)
|
||||
spec.minOccurs = 0
|
||||
run("A specification that is optional and has at least one applicable entity but no requirements shall pass", test_ids, model, True, [wall, waldo], None)
|
||||
|
||||
test_ids = ids.Ids(title="Title")
|
||||
spec = ids.Specification(name="Name")
|
||||
spec.applicability.append(ids.Entity(name="IFCWALL"))
|
||||
test_ids.specifications.append(spec)
|
||||
spec.minOccurs = 0
|
||||
spec.maxOccurs = 0
|
||||
run("A specification that is prohibited and has at least one applicable entity but no requirements shall fail", test_ids, model, False, [wall, waldo], None)
|
||||
|
||||
test_ids = ids.Ids(title="Title")
|
||||
spec = ids.Specification(name="Name")
|
||||
test_ids.specifications.append(spec)
|
||||
spec.minOccurs = 0
|
||||
spec.maxOccurs = 0
|
||||
run("A specification that is prohibited but has no applicable entities or requirements shall pass", test_ids, model, True, None, None)
|
||||
|
||||
Reference in New Issue
Block a user