diff --git a/src/caoscrawler/conv_impl/spss.py b/src/caoscrawler/conv_impl/spss.py index 903dea277de0b4659b130a8c02fea28810159407..51528cc2c6c292fac2be7b1bf857fe5912bf4201 100644 --- a/src/caoscrawler/conv_impl/spss.py +++ b/src/caoscrawler/conv_impl/spss.py @@ -72,12 +72,14 @@ def spss_to_yaml(savfile: str, yamlfile: str) -> None: prop["description"] = desc # Handle categorial variables if var_label := meta.variable_to_label.get(name): - prop["datatype"] = var_label vvl = meta.variable_value_labels[name] # reproducible (and sensible) order label_values = [vvl[key] for key in sorted(vvl.keys())] if label_values not in enums.values(): enums[var_label] = label_values + else: + var_label = [key for key, value in enums.items() if value == label_values][0] + prop["datatype"] = var_label properties[name] = prop output = f"""# auto-generated data model from file "{savfile}". diff --git a/src/caoscrawler/structure_elements.py b/src/caoscrawler/structure_elements.py index ff070626ebfdd580c16bbbf2dc30ab330dc162f0..0efba91c185446e0bfbecbbb53f68aaa8a8e15d1 100644 --- a/src/caoscrawler/structure_elements.py +++ b/src/caoscrawler/structure_elements.py @@ -23,7 +23,6 @@ # ** end header # -from typing import Dict as tDict import warnings @@ -39,7 +38,7 @@ name: str def __init__(self, name: str): # Used to store usage information for debugging: - self.metadata: tDict[str, set[str]] = { + self.metadata: dict[str, set[str]] = { "usage": set() } diff --git a/unittests/test_converters.py b/unittests/test_converters.py index 0e90fab391fd5f717b58716ddab4a2a266ce1761..2f62ef9216974bc4939667c0cb28971044c1f80c 100644 --- a/unittests/test_converters.py +++ b/unittests/test_converters.py @@ -3,8 +3,9 @@ # # This file is a part of the CaosDB Project. # -# Copyright (C) 2021,2022 Indiscale GmbH <info@indiscale.com> +# Copyright (C) 2021-2024 Indiscale GmbH <info@indiscale.com> # Copyright (C) 2021,2022 Henrik tom Wörden <h.tomwoerden@indiscale.com> +# Copyright (C) 2024 Daniel Hornung <d.hornung@indiscale.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -632,7 +633,7 @@ def test_load_converters(): # converter classes can be loaded from their respective packages. # Please adapt, if defaults change! - assert len(converter_registry) == 22 + assert len(converter_registry) == 23 # All of them are contained in caoscrawler.converters for conv_key, conv in converter_registry.items():