From 418574fe40cddfb110fa8ab1303924ee3e362294 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Fri, 15 Jan 2021 20:06:11 +0100 Subject: [PATCH] bimtester: steps, translate ifcdata provide ifc file by argument --- src/ifcbimtester/bimtester/features/steps/ifcdata.py | 8 +++----- .../bimtester/features/steps/ifcdata_de.py | 8 +++++++- .../bimtester/features/steps/ifcdata_fr.py | 9 +++++++++ .../bimtester/features/steps/ifcdata_methods.py | 10 ++++++++++ .../features/grundlagen.feature | 4 ++-- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata.py b/src/ifcbimtester/bimtester/features/steps/ifcdata.py index 7a13b157be..ad5177aa56 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata.py @@ -28,12 +28,10 @@ def step_impl(context, file): assert False, f"The file {file} could not be loaded" -@given('The IFC file has been provided through an argument') +@given("The IFC file has been provided through an argument") def step_impl(context): - try: - IfcFile.load(context.config.userdata.get("ifcfile")) - except: - assert False, f"The IFC {context.config.userdata.get('ifcfile')} file could not be loaded" + switch_locale(context.localedir, the_lang) + idm.provide_ifcfile_by_argument(context) @given('A file path has been provided through an argument') diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py b/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py index d6b3598924..bd02372155 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata_de.py @@ -7,7 +7,13 @@ from utils import switch_locale the_lang = "de" -@step("Die IFC Daten müssen das {schema} Schema benutzen") +@given("Die IFC-Datei wurde durch einen Startparameter zur Verfügung gestellt") +def step_impl(context): + switch_locale(context.localedir, the_lang) + idm.provide_ifcfile_by_argument(context) + + +@step("Die IFC-Daten müssen das {schema} Schema benutzen") def step_impl(context, schema): switch_locale(context.localedir, the_lang) idm.has_ifcdata_specific_schema(context, schema) diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py b/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py index a9f67804fd..c1d3b6526c 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata_fr.py @@ -7,6 +7,15 @@ from utils import switch_locale the_lang = "fr" +""" +# TODO the next line needs translation +@given("The IFC file has been provided through an argument") +def step_impl(context): + switch_locale(context.localedir, the_lang) + idm.provide_ifcfile_by_argument(context) +""" + + @step("Les données IFC doivent utiliser le schéma {schema}") def step_impl(context, schema): switch_locale(context.localedir, the_lang) diff --git a/src/ifcbimtester/bimtester/features/steps/ifcdata_methods.py b/src/ifcbimtester/bimtester/features/steps/ifcdata_methods.py index c39f2c4399..d42e563de4 100644 --- a/src/ifcbimtester/bimtester/features/steps/ifcdata_methods.py +++ b/src/ifcbimtester/bimtester/features/steps/ifcdata_methods.py @@ -1,6 +1,16 @@ from utils import IfcFile +def provide_ifcfile_by_argument(context): + try: + IfcFile.load(context.config.userdata.get("ifcfile")) + except: + assert False, ( + _("The IFC {} file could not be loaded") + .format(context.config.userdata.get('ifcfile')) + ) + + def has_ifcdata_specific_schema(context, target_schema): real_schema = IfcFile.get().schema assert real_schema == target_schema, ( diff --git a/src/ifcbimtester/examples/01_ifcschema_translated/features/grundlagen.feature b/src/ifcbimtester/examples/01_ifcschema_translated/features/grundlagen.feature index ead026f129..b46dcf82c7 100644 --- a/src/ifcbimtester/examples/01_ifcschema_translated/features/grundlagen.feature +++ b/src/ifcbimtester/examples/01_ifcschema_translated/features/grundlagen.feature @@ -9,8 +9,8 @@ Wir brauchen eine IFC-Datei Szenario: Bereitstellen von IFC-Daten - * The IFC file has been provided through an argument - * Die IFC Daten müssen das IFC2X3 Schema benutzen + * Die IFC-Datei wurde durch einen Startparameter zur Verfügung gestellt + * Die IFC-Daten müssen das IFC2X3 Schema benutzen Szenario: Projektinformationen