diff --git a/src/ifcblenderexport/features/steps/example_steps.py b/src/ifcblenderexport/features/steps/example_steps.py index a514985f48..a2abaf7411 100644 --- a/src/ifcblenderexport/features/steps/example_steps.py +++ b/src/ifcblenderexport/features/steps/example_steps.py @@ -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)