Unverified Commit 2bfd283f authored by mvdbeek's avatar mvdbeek
Browse files

Fix single data element identifier to be a regular string

These must adhere to the input parameter they belong to.
parent 400a9f60
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -78,9 +78,8 @@ def data_input_to_staging_path_and_source_path(
    v: "DatasetFilenameWrapper", invalid_chars: Sequence[str] = ("/",)
) -> Dict[str, Any]:
    staging_path = v.get_staging_path(invalid_chars=invalid_chars)
    # note that the element identifier should be always a list
    return {
        "element_identifier": [v.element_identifier],
        "element_identifier": v.element_identifier,
        "ext": v.file_ext,
        "staging_path": staging_path,
        "source_path": data_input_to_path(v),
+2 −2
Original line number Diff line number Diff line
@@ -12,14 +12,14 @@ input_json_path = sys.argv[1]
as_dict = json.load(open(input_json_path, "r"))

data_input_with_staging_details = as_dict["data_input"]
assert data_input_with_staging_details['element_identifier'] == ["1.tabular"]
assert data_input_with_staging_details['element_identifier'] == "1.tabular"
assert data_input_with_staging_details['ext'] == "tabular"
assert data_input_with_staging_details['staging_path'] == "1.tabular.tabular"
assert len(data_input_with_staging_details['metadata_files']) == 0

multiple_data_input_with_staging_details = as_dict["multiple_data_input"]
assert len(multiple_data_input_with_staging_details) == 2
assert multiple_data_input_with_staging_details[0]['element_identifier'] == ["simple_line.txt"]
assert multiple_data_input_with_staging_details[0]['element_identifier'] == "simple_line.txt"
assert multiple_data_input_with_staging_details[0]['ext'] == "txt"
assert multiple_data_input_with_staging_details[0]['staging_path'] == "simple_line.txt.txt"
assert len(multiple_data_input_with_staging_details[0]['metadata_files']) == 0