mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Define a few more steps
This commit is contained in:
@@ -1,14 +1,33 @@
|
|||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
from behave import given, when, then, step
|
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}"')
|
@given('the IFC file "{file}"')
|
||||||
def step_impl(context, 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}')
|
@then('the element {id} is an {ifc_class}')
|
||||||
def step_impl(context, id, 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}')
|
@then('the element {id} should not exist because {reason}')
|
||||||
def step_impl(context, id, reason):
|
def step_impl(context, id, reason):
|
||||||
assert not context.file.by_id(id)
|
assert not IfcFile.get().by_id(id)
|
||||||
|
|||||||
Reference in New Issue
Block a user