Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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 Python Integration Tests
Commits
68afeba7
Verified
Commit
68afeba7
authored
2 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: Moved test function to more appropriate file.
parent
1d20070b
No related branches found
No related tags found
1 merge request
!54
Get parents recursively
Pipeline
#33722
canceled
2 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_parents.py
+0
-20
0 additions, 20 deletions
tests/test_parents.py
tests/test_recursive_parents.py
+20
-2
20 additions, 2 deletions
tests/test_recursive_parents.py
with
20 additions
and
22 deletions
tests/test_parents.py
+
0
−
20
View file @
68afeba7
...
...
@@ -41,23 +41,3 @@ def test_parent_name_id_mismatch():
with
raises
(
db
.
TransactionError
):
rt2
.
insert
()
print
(
rt2
)
def
test_get_parents_recursively
():
"""
Test for https://gitlab.com/caosdb/caosdb-pylib/-/issues/90
> Entity.get_parents_recursively() does not work unless the full ancestry has been retrieved from
> the server.
"""
# Setup
rt_A
=
db
.
RecordType
(
name
=
"
TestA
"
)
rt_B
=
db
.
RecordType
(
name
=
"
TestB
"
).
add_parent
(
rt_A
)
rt_C
=
db
.
RecordType
(
name
=
"
TestC
"
).
add_parent
(
rt_B
)
db
.
Container
().
extend
([
rt_A
,
rt_B
,
rt_C
]).
insert
()
# Retrieve only C
retrieved_C
=
db
.
RecordType
(
name
=
"
TestC
"
).
retrieve
()
parents
=
retrieved_C
.
get_parents_recursively
(
retrieve
=
True
)
assert
len
(
parents
)
==
2
assert
"
TestB
"
in
[
p
.
name
for
p
in
parents
]
assert
"
TestA
"
in
[
p
.
name
for
p
in
parents
]
This diff is collapsed.
Click to expand it.
tests/test_recursive_parents.py
+
20
−
2
View file @
68afeba7
...
...
@@ -48,7 +48,26 @@ def teardown_function(function):
setup_module
()
# @pytest.mark.xfail(reason="To be fixed in server and/or pylib")
def
test_get_parents_recursively
():
"""
Test for https://gitlab.com/caosdb/caosdb-pylib/-/issues/90
> Entity.get_parents_recursively() does not work unless the full ancestry has been retrieved from
> the server.
"""
# Setup
rt_A
=
db
.
RecordType
(
name
=
"
TestA
"
)
rt_B
=
db
.
RecordType
(
name
=
"
TestB
"
).
add_parent
(
rt_A
)
rt_C
=
db
.
RecordType
(
name
=
"
TestC
"
).
add_parent
(
rt_B
)
db
.
Container
().
extend
([
rt_A
,
rt_B
,
rt_C
]).
insert
()
# Retrieve only C
retrieved_C
=
db
.
RecordType
(
name
=
"
TestC
"
).
retrieve
()
parents
=
retrieved_C
.
get_parents_recursively
(
retrieve
=
True
)
assert
len
(
parents
)
==
2
assert
"
TestB
"
in
[
p
.
name
for
p
in
parents
]
assert
"
TestA
"
in
[
p
.
name
for
p
in
parents
]
def
test_recursive_parents
():
# inheritance structure:
# A
...
...
@@ -91,7 +110,6 @@ def test_recursive_parents():
assert
(
C
.
id
,
C
.
name
)
in
parent_identifiers
# @pytest.mark.xfail(reason="To be fixed in server and/or pylib")
def
test_entity_has_parent
():
# inheritance structure:
# A
...
...
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