Skip to content
Snippets Groups Projects
Commit 6555c64d authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: added Tests and doc

parent 6fa138ce
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,8 @@ def find_file_included_by(glob): ...@@ -76,6 +76,8 @@ def find_file_included_by(glob):
""" """
Executes a query that looks for files included by a glob. The glob needs Executes a query that looks for files included by a glob. The glob needs
to be according to CaosDB rules. to be according to CaosDB rules.
Returns a container.
""" """
query_string = "FIND file which is stored at {}".format(glob) query_string = "FIND file which is stored at {}".format(glob)
......
...@@ -21,10 +21,9 @@ ...@@ -21,10 +21,9 @@
# #
# ** end header # ** end header
import unittest 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): class Assure_absoluteTest(unittest.TestCase):
...@@ -37,3 +36,22 @@ class Assure_absoluteTest(unittest.TestCase): ...@@ -37,3 +36,22 @@ class Assure_absoluteTest(unittest.TestCase):
def test_compress(self): def test_compress(self):
assert assure_absolute_path_in_glob("../leute", "/Data") == "/leute" 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment