diff --git a/integrationtests/model.yml b/integrationtests/model.yml index 0a4ad381bfc119dd65d2c192f8de823deda525ae..c9c7708a090c886191df86156cf20c91da394000 100644 --- a/integrationtests/model.yml +++ b/integrationtests/model.yml @@ -35,11 +35,11 @@ responsible: revisionOf: datatype: REFERENCE results: - datatype: REFERENCE + datatype: LIST<REFERENCE> sources: - datatype: REFERENCE + datatype: LIST<REFERENCE> scripts: - datatype: REFERENCE + datatype: LIST<REFERENCE> Simulation: obligatory_properties: date: diff --git a/src/caosadvancedtools/models/parser.py b/src/caosadvancedtools/models/parser.py index d88d78a87dc27aea9b9e9f012c910c8ffec9a0ed..5a548cdc085d81e5b1edd2da6bdd9fd379e0f603 100644 --- a/src/caosadvancedtools/models/parser.py +++ b/src/caosadvancedtools/models/parser.py @@ -50,7 +50,11 @@ def _get_listdatatype(dtype): returns the type within the list or None, if it cannot be matched with a list definition """ - match = re.match(r"^LIST[(](?P<dt>.*)[)]$", dtype) + # TODO: string representation should be the same as used by the server: + # e.g. LIST<TEXT> + # this should be changed in the module and the old behavour should be + # marked as depricated + match = re.match(r"^LIST[(<](?P<dt>.*)[)>]$", dtype) if match is None: return None diff --git a/unittests/test_parser.py b/unittests/test_parser.py index 620c9792ef9e68b06ea59d112603cdace7aabc7e..64c98e9b531f20733a9a38143d9371e1efb58eac 100644 --- a/unittests/test_parser.py +++ b/unittests/test_parser.py @@ -202,12 +202,16 @@ RT1: datatype: LIST(RT2) b: datatype: LIST(TEXT) + c: + datatype: LIST<TEXT> RT2: """ model = parse_model_from_yaml(to_file(string)) self.assertTrue(isinstance(model['b'], db.Property)) self.assertEqual(model['b'].datatype, db.LIST(db.TEXT)) + self.assertTrue(isinstance(model['c'], db.Property)) + self.assertEqual(model['c'].datatype, db.LIST(db.TEXT)) # This failed for an older version of caosdb-models string_list = """