From 2215ac56f5e214fb7d328add895620b5d2929e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Sat, 17 Jul 2021 17:37:08 +0200 Subject: [PATCH] doc --- integrationtests/model.yml | 6 +++--- src/caosadvancedtools/models/parser.py | 6 +++++- unittests/test_parser.py | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/integrationtests/model.yml b/integrationtests/model.yml index 0a4ad381..c9c7708a 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 d88d78a8..5a548cdc 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 620c9792..64c98e9b 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 = """ -- GitLab