Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
b1b9cedd
Commit
b1b9cedd
authored
5 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: added Tests and doc
parent
9c06c0a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/utils.py
+2
-0
2 additions, 0 deletions
src/caosadvancedtools/utils.py
unittests/test_utils.py
+21
-3
21 additions, 3 deletions
unittests/test_utils.py
with
23 additions
and
3 deletions
src/caosadvancedtools/utils.py
+
2
−
0
View file @
b1b9cedd
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
unittests/test_utils.py
+
21
−
3
View file @
b1b9cedd
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment