diff --git a/src/caosadvancedtools/utils.py b/src/caosadvancedtools/utils.py index 4fd569a1e928d916b863ff2ba4f66a6b7c2d3aa6..b030a6c29d98388fae4e17fef37a60d8fa2e980c 100644 --- a/src/caosadvancedtools/utils.py +++ b/src/caosadvancedtools/utils.py @@ -76,6 +76,8 @@ def find_file_included_by(glob): """ Executes a query that looks for files included by a glob. The glob needs to be according to CaosDB rules. + + Returns a container. """ query_string = "FIND file which is stored at {}".format(glob) diff --git a/unittests/test_utils.py b/unittests/test_utils.py index 1b93eebedc334b3c696fd3da82f98b3f14671514..24082d47dd574d16a5432b7138a8b89d67654c5b 100644 --- a/unittests/test_utils.py +++ b/unittests/test_utils.py @@ -21,10 +21,9 @@ # # ** end header import unittest -from tempfile import NamedTemporaryFile -import caosdb as db -from caosadvancedtools.utils import assure_absolute_path_in_glob +from caosadvancedtools.utils import (assure_absolute_path_in_glob, + string_to_person) class Assure_absoluteTest(unittest.TestCase): @@ -37,3 +36,22 @@ class Assure_absoluteTest(unittest.TestCase): def test_compress(self): assert assure_absolute_path_in_glob("../leute", "/Data") == "/leute" + + +def is_dhornung(rec): + if (rec.get_property("firstname").value == "Daniel" + and rec.get_property("lastname").value == "Hornung"): + + return True + + return False + + +class PersonParserTest(unittest.TestCase): + def test_simple(self): + rec = string_to_person("Daniel Hornung") + assert is_dhornung(rec) + rec = string_to_person("Daniel Hornung (MPI)") + assert is_dhornung(rec) + rec = string_to_person("Henrik tom Wörden (MPI)") + assert not is_dhornung(rec)