From adb3e448bbced6e41dff8145b3731d6dd4631c08 Mon Sep 17 00:00:00 2001 From: Sherjeel Shabih Date: Mon, 20 Nov 2023 12:07:21 +0100 Subject: [PATCH] Sets the json_map reader as the default for dataconverter --- pynxtools/dataconverter/convert.py | 11 ++--------- tests/dataconverter/test_convert.py | 2 ++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pynxtools/dataconverter/convert.py b/pynxtools/dataconverter/convert.py index e596dcd84..8096ccb91 100644 --- a/pynxtools/dataconverter/convert.py +++ b/pynxtools/dataconverter/convert.py @@ -155,7 +155,7 @@ def parse_params_file(params_file): ) @click.option( '--reader', - default='example', + default='json_map', type=click.Choice(get_names_of_all_readers(), case_sensitive=False), help='The reader to use. default="example"' ) @@ -194,12 +194,6 @@ def parse_params_file(params_file): default=False, help='Shows a log output for all undocumented fields' ) -@click.option( - '--merge-partial', - is_flag=True, - default=False, - help='Merges partial NeXus files provided as different --input-file to the converter.' -) @click.option( '--mapping', help='Takes a .mapping.json file and converts data from given input files.' @@ -213,7 +207,6 @@ def convert_cli(input_file: Tuple[str, ...], fair: bool, params_file: str, undocumented: bool, - merge_partial: bool, mapping: str): """The CLI entrypoint for the convert function""" if params_file: @@ -230,7 +223,7 @@ def convert_cli(input_file: Tuple[str, ...], sys.tracebacklimit = 0 raise IOError("\nError: Please supply an NXDL file with the option:" " --nxdl ") - if merge_partial or mapping: + if mapping: reader = "json_map" if mapping: input_file = input_file + tuple([mapping]) diff --git a/tests/dataconverter/test_convert.py b/tests/dataconverter/test_convert.py index f6702bf01..e0b17c5ad 100644 --- a/tests/dataconverter/test_convert.py +++ b/tests/dataconverter/test_convert.py @@ -61,6 +61,8 @@ def restore_xarray_file_from_tmp(tmp_path): ]) def test_find_nxdl(cli_inputs): """Unit test to check if dataconverter can find NXDLs in contributed/applications folder.""" + cli_inputs.extend(["--reader", "example"]) + runner = CliRunner() result = runner.invoke(dataconverter.convert_cli, cli_inputs) if "NXdoesnotexist" in cli_inputs: