mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
bimtester: improve submodule handling for step translation
This commit is contained in:
committed by
Dion Moult
parent
f00040c7d9
commit
90f225e93b
@@ -1,5 +1,6 @@
|
||||
from behave import step
|
||||
|
||||
from utils import assert_schema
|
||||
from utils import IfcFile
|
||||
|
||||
|
||||
@@ -13,10 +14,9 @@ def step_impl(context, file):
|
||||
|
||||
@step("IFC data must use the {schema} schema")
|
||||
def step_impl(context, schema):
|
||||
assert IfcFile.get().schema == schema, "We expected a schema of {} but instead got {}".format(
|
||||
schema, IfcFile.get().schema
|
||||
)
|
||||
|
||||
context.schema = IfcFile.get().schema
|
||||
assert_schema(schema, context.schema)
|
||||
|
||||
|
||||
@step('The IFC file "{file}" is exempt from being provided')
|
||||
def step_impl(context, file):
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
from behave import step
|
||||
|
||||
from utils import assert_schema
|
||||
|
||||
|
||||
# https://behave.readthedocs.io/en/latest/api.html#step-macro-calling-steps-from-other-steps
|
||||
# https://stackoverflow.com/questions/46735425/how-to-only-show-failing-tests-from-behave
|
||||
# https://community.osarch.org/discussion/comment/4533/#Comment_4533
|
||||
|
||||
|
||||
@step("Die IFC daten müssen das {schema} Schema benutzen")
|
||||
@step("Die IFC Daten müssen das {schema} Schema benutzen")
|
||||
def step_impl(context, schema):
|
||||
context.execute_steps(
|
||||
"* IFC data must use the {schema} schema".format(schema=schema)
|
||||
)
|
||||
try:
|
||||
context.execute_steps(
|
||||
"* IFC data must use the {schema} schema".format(schema=schema)
|
||||
)
|
||||
except Exception:
|
||||
assert_schema(schema, context.schema)
|
||||
# TODO translate error
|
||||
# "Wir haben ein Schema {} erwartet, aber die Daten sind Schema (}"
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
from behave import step
|
||||
|
||||
# https://behave.readthedocs.io/en/latest/api.html#step-macro-calling-steps-from-other-steps
|
||||
from utils import assert_schema
|
||||
|
||||
|
||||
@step("Les données IFC doivent utiliser le schéma {schema}")
|
||||
def step_impl(context, schema):
|
||||
context.execute_steps(
|
||||
"* IFC data must use the {aschema} schema".format(aschema=schema)
|
||||
)
|
||||
try:
|
||||
context.execute_steps(
|
||||
"* IFC data must use the {schema} schema".format(schema=schema)
|
||||
)
|
||||
except Exception:
|
||||
assert_schema(schema, context.schema)
|
||||
|
||||
@@ -78,3 +78,10 @@ def assert_pset(element, pset_name, prop_name=None, value=None):
|
||||
assert actual_value == value, 'We expected a value of "{}" but instead got "{}" for the element {}'.format(
|
||||
value, actual_value, element
|
||||
)
|
||||
|
||||
|
||||
def assert_schema(real_schema, target_schema):
|
||||
assert real_schema == target_schema, (
|
||||
"We expected a schema of {} but instead got {}"
|
||||
.format(target_schema, real_schema)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user