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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
a0ea81dc
Commit
a0ea81dc
authored
Jul 15, 2021
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
7778607d
No related branches found
No related tags found
1 merge request
!8
F h5 cfood
Pipeline
#10368
passed
Jul 15, 2021
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tox.ini
+1
-1
1 addition, 1 deletion
tox.ini
unittests/test_h5.py
+8
-5
8 additions, 5 deletions
unittests/test_h5.py
with
9 additions
and
6 deletions
tox.ini
+
1
−
1
View file @
a0ea81dc
...
@@ -4,7 +4,7 @@ skip_missing_interpreters = true
...
@@ -4,7 +4,7 @@ skip_missing_interpreters = true
[testenv]
[testenv]
deps
=
nose
deps
=
nose
pandas
pandas
caosdb
git+https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git@dev
pytest
pytest
pytest-cov
pytest-cov
openpyxl
openpyxl
...
...
This diff is collapsed.
Click to expand it.
unittests/test_h5.py
+
8
−
5
View file @
a0ea81dc
...
@@ -2,6 +2,7 @@ import unittest
...
@@ -2,6 +2,7 @@ import unittest
from
tempfile
import
NamedTemporaryFile
from
tempfile
import
NamedTemporaryFile
import
caosdb
as
db
import
caosdb
as
db
import
caosdb.apiutils
import
h5py
import
h5py
import
numpy
as
np
import
numpy
as
np
from
caosadvancedtools.cfoods
import
h5
from
caosadvancedtools.cfoods
import
h5
...
@@ -21,9 +22,6 @@ def dummy_get(eid):
...
@@ -21,9 +22,6 @@ def dummy_get(eid):
return
ENTS
[
eid
]
return
ENTS
[
eid
]
h5
.
get_entity
=
dummy_get
class
H5CFoodTest
(
unittest
.
TestCase
):
class
H5CFoodTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
h5file
=
NamedTemporaryFile
(
delete
=
False
,
suffix
=
"
.h5
"
)
self
.
h5file
=
NamedTemporaryFile
(
delete
=
False
,
suffix
=
"
.h5
"
)
...
@@ -76,6 +74,9 @@ class H5CFoodTest(unittest.TestCase):
...
@@ -76,6 +74,9 @@ class H5CFoodTest(unittest.TestCase):
self
.
assertEqual
(
i
.
name
,
"
group_level2_aa
"
)
self
.
assertEqual
(
i
.
name
,
"
group_level2_aa
"
)
def
test_collect_existing_structure
(
self
):
def
test_collect_existing_structure
(
self
):
real_retrieve
=
caosdb
.
apiutils
.
retrieve_entity_with_id
caosdb
.
apiutils
.
retrieve_entity_with_id
=
dummy_get
# should run without problem
# should run without problem
h5
.
collect_existing_structure
(
db
.
Record
(),
db
.
Record
(
id
=
234
),
h5
.
EntityMapping
())
h5
.
collect_existing_structure
(
db
.
Record
(),
db
.
Record
(
id
=
234
),
h5
.
EntityMapping
())
...
@@ -88,8 +89,8 @@ class H5CFoodTest(unittest.TestCase):
...
@@ -88,8 +89,8 @@ class H5CFoodTest(unittest.TestCase):
r_target
.
add_property
(
"
test
"
,
value
=
r_child
,
datatype
=
db
.
REFERENCE
)
r_target
.
add_property
(
"
test
"
,
value
=
r_child
,
datatype
=
db
.
REFERENCE
)
em
=
h5
.
EntityMapping
()
em
=
h5
.
EntityMapping
()
h5
.
collect_existing_structure
(
r_target
,
r_exist
,
em
)
h5
.
collect_existing_structure
(
r_target
,
r_exist
,
em
)
self
.
assert
Equal
(
em
.
to_existing
[
r_child
.
_cuid
]
,
ENTS
[
101
])
self
.
assert
True
(
em
.
to_existing
[
r_child
.
_cuid
]
is
ENTS
[
101
])
self
.
assert
Equal
(
em
.
to_target
[
101
]
,
r_child
)
self
.
assert
True
(
em
.
to_target
[
101
]
is
r_child
)
# test with retrieval: the existing Record has another Property
# test with retrieval: the existing Record has another Property
# -> The referenced Entities are matched
# -> The referenced Entities are matched
...
@@ -147,6 +148,8 @@ class H5CFoodTest(unittest.TestCase):
...
@@ -147,6 +148,8 @@ class H5CFoodTest(unittest.TestCase):
self
.
assertEqual
(
em
.
to_existing
[
r_child2
.
_cuid
],
ENTS
[
101
])
self
.
assertEqual
(
em
.
to_existing
[
r_child2
.
_cuid
],
ENTS
[
101
])
self
.
assertEqual
(
em
.
to_target
[
101
],
r_child2
)
self
.
assertEqual
(
em
.
to_target
[
101
],
r_child2
)
caosdb
.
apiutils
.
retrieve_entity_with_id
=
real_retrieve
def
test_h5_attr_to_property
(
self
):
def
test_h5_attr_to_property
(
self
):
test_int
:
int
=
1
test_int
:
int
=
1
...
...
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