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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
ccabcbbb
Commit
ccabcbbb
authored
4 months ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST: adapted tests for eln files
parent
afefa748
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!217
TST: Make NamedTemporaryFiles Windows-compatible
,
!215
Fix issues in rocrate support
Pipeline
#60020
failed
4 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
unittests/eln_files/PASTA.eln
+0
-0
0 additions, 0 deletions
unittests/eln_files/PASTA.eln
unittests/eln_files/records-example.eln
+0
-0
0 additions, 0 deletions
unittests/eln_files/records-example.eln
unittests/test_rocrate_converter.py
+22
-3
22 additions, 3 deletions
unittests/test_rocrate_converter.py
with
22 additions
and
3 deletions
unittests/eln_files/PASTA.eln
deleted
100644 → 0
+
0
−
0
View file @
afefa748
File deleted
This diff is collapsed.
Click to expand it.
unittests/eln_files/records-example.eln
+
0
−
0
View file @
ccabcbbb
No preview for this file type
This diff is collapsed.
Click to expand it.
unittests/test_rocrate_converter.py
+
22
−
3
View file @
ccabcbbb
...
@@ -76,6 +76,12 @@ def eln_entities(basic_eln_converter):
...
@@ -76,6 +76,12 @@ def eln_entities(basic_eln_converter):
return
entities
return
entities
@pytest.mark.xfail
(
reason
=
"
The example files for PASTA have not yet been updated in:
"
"
https://github.com/TheELNConsortium/TheELNFileFormat/tree/master/examples/PASTA
"
"
However, there was the announcement that these files are going to follow the
"
"
flattened structure soon: https://github.com/TheELNConsortium/TheELNFileFormat/issues/98
"
)
def
test_load_pasta
(
basic_eln_converter
):
def
test_load_pasta
(
basic_eln_converter
):
"""
"""
Test for loading the .eln example export from PASTA.
Test for loading the .eln example export from PASTA.
...
@@ -99,7 +105,7 @@ def test_load_kadi4mat(basic_eln_converter):
...
@@ -99,7 +105,7 @@ def test_load_kadi4mat(basic_eln_converter):
match
=
basic_eln_converter
.
match
(
f_k4mat
)
match
=
basic_eln_converter
.
match
(
f_k4mat
)
assert
match
is
not
None
assert
match
is
not
None
entities
=
basic_eln_converter
.
create_children
(
GeneralStore
(),
f_k4mat
)
entities
=
basic_eln_converter
.
create_children
(
GeneralStore
(),
f_k4mat
)
assert
len
(
entities
)
==
1
0
assert
len
(
entities
)
==
1
7
assert
isinstance
(
entities
[
0
],
ROCrateEntity
)
assert
isinstance
(
entities
[
0
],
ROCrateEntity
)
assert
isinstance
(
entities
[
0
].
folder
,
str
)
assert
isinstance
(
entities
[
0
].
folder
,
str
)
assert
isinstance
(
entities
[
0
].
entity
,
Entity
)
assert
isinstance
(
entities
[
0
].
entity
,
Entity
)
...
@@ -131,7 +137,7 @@ match_properties:
...
@@ -131,7 +137,7 @@ match_properties:
match
=
ds2
.
match
(
eln_entities
[
1
])
match
=
ds2
.
match
(
eln_entities
[
1
])
assert
match
is
not
None
assert
match
is
not
None
assert
match
[
"
dateCreated
"
]
==
"
2024-
08-21T12:07:45.115990
+00:00
"
assert
match
[
"
dateCreated
"
]
==
"
2024-
11-19T13:44:35.476888
+00:00
"
children
=
ds2
.
create_children
(
GeneralStore
(),
eln_entities
[
1
])
children
=
ds2
.
create_children
(
GeneralStore
(),
eln_entities
[
1
])
assert
len
(
children
)
==
8
assert
len
(
children
)
==
8
...
@@ -193,7 +199,20 @@ def test_scanner():
...
@@ -193,7 +199,20 @@ def test_scanner():
assert
len
(
rlist
)
==
1
assert
len
(
rlist
)
==
1
assert
isinstance
(
rlist
[
0
],
db
.
Record
)
assert
isinstance
(
rlist
[
0
],
db
.
Record
)
assert
rlist
[
0
].
name
==
"
records-example
"
assert
rlist
[
0
].
name
==
"
records-example
"
assert
rlist
[
0
].
description
==
"
This is a sample record.
"
# This assertion was moved to a different test, see below:
# assert rlist[0].description == "This is a sample record."
assert
rlist
[
0
].
parents
[
0
].
name
==
"
Dataset
"
assert
rlist
[
0
].
parents
[
0
].
name
==
"
Dataset
"
assert
rlist
[
0
].
get_property
(
"
keywords
"
).
value
==
"
sample
"
assert
rlist
[
0
].
get_property
(
"
keywords
"
).
value
==
"
sample
"
assert
rlist
[
0
].
get_property
(
"
dateModified
"
).
value
==
"
2024-08-21T11:43:17.626965+00:00
"
assert
rlist
[
0
].
get_property
(
"
dateModified
"
).
value
==
"
2024-08-21T11:43:17.626965+00:00
"
@pytest.mark.xfail
(
reason
=
"
The description is no longer a simple string, but a reference to another record.
"
"
The rocrate converter will be able to dereference this as soon as this feature is implemented:
"
"
https://gitlab.indiscale.com/caosdb/src/caosdb-crawler/-/issues/191
"
"
This test might need changes in the yaml definition.
"
)
def
test_description_reference
():
rlist
=
scanner
.
scan_directory
(
os
.
path
.
join
(
UNITTESTDIR
,
"
eln_files/
"
),
os
.
path
.
join
(
UNITTESTDIR
,
"
eln_cfood.yaml
"
))
assert
rlist
[
0
].
description
==
"
This is a sample record.
"
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