Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
4c925e19
Commit
4c925e19
authored
1 year ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST: added test for creating File entities
parent
0bec5c0c
No related branches found
No related tags found
No related merge requests found
Pipeline
#51709
failed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
unittests/cfood_simple_file.yml
+52
-0
52 additions, 0 deletions
unittests/cfood_simple_file.yml
unittests/test_scanner.py
+9
-0
9 additions, 0 deletions
unittests/test_scanner.py
with
61 additions
and
0 deletions
unittests/cfood_simple_file.yml
0 → 100644
+
52
−
0
View file @
4c925e19
# This is only a scifolder test cfood with a limited functionality.
# The full scifolder cfood will be developed here:
# https://gitlab.indiscale.com/caosdb/src/crawler-cfoods/scifolder-cfood
---
metadata
:
crawler-version
:
0.3.1
---
Definitions
:
type
:
Definitions
#include "description.yml"
Data
:
# name of the converter
type
:
Directory
match
:
(.*)
subtree
:
DataAnalysis
:
# name of the converter
type
:
Directory
match
:
DataAnalysis
subtree
:
&template
project_dir
:
# name of the first subtree element which is a converter
type
:
Directory
match
:
((?P<date>[0-9]{4,4})_)?(?P<identifier>.*)
records
:
Project
:
# this is an identifiable in this case
parents
:
-
Project
# not needed as the name is equivalent
date
:
$date
identifier
:
${identifier}
subtree
:
measurement
:
# new name for folders on the 3rd level
type
:
Directory
match
:
(?P<date>[0-9]{4,4}-[0-9]{2,2}-[0-9]{2,2})(_(?P<identifier>.*))?
records
:
Measurement
:
date
:
$date
identifier
:
$identifier
project
:
$Project
subtree
:
README
:
type
:
SimpleFile
# this is a subclass of converter File
# function signature: GeneralStore, StructureElement
# preprocessors: custom.caosdb.convert_values
match
:
^README\.md$
# how to make match case insensitive?
records
:
TestFile
:
path
:
$README
file
:
$README
role
:
File
This diff is collapsed.
Click to expand it.
unittests/test_scanner.py
+
9
−
0
View file @
4c925e19
...
@@ -332,3 +332,12 @@ def test_new_debug_tree():
...
@@ -332,3 +332,12 @@ def test_new_debug_tree():
"
unittests/test_directories/examples_article
"
)
"
unittests/test_directories/examples_article
"
)
assert
len
(
new_debug_tree
[
0
][
"
matching_converters
"
])
==
1
# exactly one matches
assert
len
(
new_debug_tree
[
0
][
"
matching_converters
"
])
==
1
# exactly one matches
assert
len
(
new_debug_tree
[
0
][
"
matching_converters
"
][
0
][
"
subtree
"
])
==
4
assert
len
(
new_debug_tree
[
0
][
"
matching_converters
"
][
0
][
"
subtree
"
])
==
4
def
test_new_debug_tree_files
():
new_debug_tree
=
[]
scan_directory
(
UNITTESTDIR
/
"
test_directories
"
/
"
examples_article
"
,
UNITTESTDIR
/
"
cfood_simple_file.yml
"
,
new_debug_tree
=
new_debug_tree
)
assert
True
# The only purpose of this test is to check whether
# it is possible to create a File entity and set a path.
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