Define a few more steps

This commit is contained in:
Dion Moult
2019-10-11 17:23:20 +11:00
parent 7513906aaa
commit 642fd08d1f
@@ -1,14 +1,33 @@
import ifcopenshell
from behave import given, when, then, step
class IfcFile(object):
file = None
@classmethod
def load(cls, path=None):
cls.file = ifcopenshell.open(path)
@classmethod
def get(cls):
return cls.file
@given('the IFC file "{file}"')
def step_impl(context, file):
context.file = ifcopenshell.open(file)
IfcFile.load(file)
@given('that an IFC file is loaded')
def step_impl(context):
assert IfcFile.get()
@then('the file should be an {schema} file')
def step_impl(context, schema):
assert IfcFile.get().schema == schema
@then('the element {id} is an {ifc_class}')
def step_impl(context, id, ifc_class):
assert context.file.by_id(id).is_a(ifc_class)
assert IfcFile.get().by_id(id).is_a(ifc_class)
@then('the element {id} should not exist because {reason}')
def step_impl(context, id, reason):
assert not context.file.by_id(id)
assert not IfcFile.get().by_id(id)