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
ccb65a96
Commit
ccb65a96
authored
Nov 5, 2024
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST(converter): first test for rocrate entity converter
parent
857b02f0
No related branches found
No related tags found
2 merge requests
!198
REL: Release 0.10.0
,
!193
ROCrate-Converter (also for .eln-files)
Pipeline
#57207
failed
Nov 5, 2024
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_rocrate_converter.py
+25
-4
25 additions, 4 deletions
unittests/test_rocrate_converter.py
with
25 additions
and
4 deletions
unittests/test_rocrate_converter.py
+
25
−
4
View file @
ccb65a96
...
...
@@ -36,7 +36,7 @@ from pathlib import Path
from
rocrate.rocrate
import
ROCrate
from
rocrate.model.entity
import
Entity
from
caoscrawler.converters
import
(
ELNFileConverter
,)
from
caoscrawler.converters
import
(
ELNFileConverter
,
ROCrateEntityConverter
)
from
caoscrawler.scanner
import
load_definition
from
caoscrawler.stores
import
GeneralStore
from
caoscrawler.structure_elements
import
ROCrateEntity
,
File
...
...
@@ -51,6 +51,10 @@ def converter_registry():
"
ELNFile
"
:
{
"
converter
"
:
"
ELNFileConverter
"
,
"
package
"
:
"
caoscrawler.converters
"
},
"
ROCrateEntity
"
:
{
"
converter
"
:
"
ROCrateEntityConverter
"
,
"
package
"
:
"
caoscrawler.converters
"
,
}
}
for
key
,
value
in
converter_registry
.
items
():
...
...
@@ -67,6 +71,15 @@ match: .*\\.eln
"""
),
"
TestELNConverter
"
,
converter_registry
)
@pytest.fixture
def
eln_entities
(
basic_eln_converter
):
f_k4mat
=
File
(
"
records-example.eln
"
,
os
.
path
.
join
(
UNITTESTDIR
,
"
eln_files
"
,
"
records-example.eln
"
))
store
=
GeneralStore
()
entities
=
basic_eln_converter
.
create_children
(
store
,
f_k4mat
)
return
entities
def
test_load_pasta
(
basic_eln_converter
):
"""
Test for loading the .eln example export from PASTA.
...
...
@@ -85,7 +98,8 @@ def test_load_kadi4mat(basic_eln_converter):
"""
Test for loading the .eln example export from PASTA.
"""
f_k4mat
=
File
(
"
records-example.eln
"
,
os
.
path
.
join
(
UNITTESTDIR
,
"
eln_files
"
,
"
records-example.eln
"
))
f_k4mat
=
File
(
"
records-example.eln
"
,
os
.
path
.
join
(
UNITTESTDIR
,
"
eln_files
"
,
"
records-example.eln
"
))
match
=
basic_eln_converter
.
match
(
f_k4mat
)
assert
match
is
not
None
entities
=
basic_eln_converter
.
create_children
(
GeneralStore
(),
f_k4mat
)
...
...
@@ -95,5 +109,12 @@ def test_load_kadi4mat(basic_eln_converter):
assert
isinstance
(
entities
[
0
].
entity
,
Entity
)
def
test_match_rocrate_element
(
basic_eln_converter
):
pass
def
test_match_rocrate_entities
(
eln_entities
):
ds1
=
ROCrateEntityConverter
(
yaml
.
safe_load
(
"""
type: ROCrateEntity
match_properties:
"
@id
"
:
\\
./
"""
),
"
TestELNConverter
"
,
converter_registry
)
match
=
ds1
.
match
(
eln_entities
[
0
])
assert
match
is
not
None
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