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
1d20070b
Verified
Commit
1d20070b
authored
2 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
FIX: recursive parent testing needed some modifications.
parent
47f697aa
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!54
Get parents recursively
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_parents.py
+1
-1
1 addition, 1 deletion
tests/test_parents.py
tests/test_recursive_parents.py
+16
-13
16 additions, 13 deletions
tests/test_recursive_parents.py
with
17 additions
and
14 deletions
tests/test_parents.py
+
1
−
1
View file @
1d20070b
...
@@ -57,7 +57,7 @@ def test_get_parents_recursively():
...
@@ -57,7 +57,7 @@ def test_get_parents_recursively():
# Retrieve only C
# Retrieve only C
retrieved_C
=
db
.
RecordType
(
name
=
"
TestC
"
).
retrieve
()
retrieved_C
=
db
.
RecordType
(
name
=
"
TestC
"
).
retrieve
()
parents
=
retrieved_C
.
get_parents_recursively
()
parents
=
retrieved_C
.
get_parents_recursively
(
retrieve
=
True
)
assert
len
(
parents
)
==
2
assert
len
(
parents
)
==
2
assert
"
TestB
"
in
[
p
.
name
for
p
in
parents
]
assert
"
TestB
"
in
[
p
.
name
for
p
in
parents
]
assert
"
TestA
"
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
+
16
−
13
View file @
1d20070b
...
@@ -48,7 +48,7 @@ def teardown_function(function):
...
@@ -48,7 +48,7 @@ def teardown_function(function):
setup_module
()
setup_module
()
@pytest.mark.xfail
(
reason
=
"
To be fixed in server and/or pylib
"
)
#
@pytest.mark.xfail(reason="To be fixed in server and/or pylib")
def
test_recursive_parents
():
def
test_recursive_parents
():
# inheritance structure:
# inheritance structure:
# A
# A
...
@@ -66,29 +66,32 @@ def test_recursive_parents():
...
@@ -66,29 +66,32 @@ def test_recursive_parents():
parents
=
C
.
get_parents_recursively
()
parents
=
C
.
get_parents_recursively
()
assert
len
(
parents
)
==
3
assert
len
(
parents
)
==
3
assert
A
in
parents
parent_identifiers
=
[(
all_p
.
id
,
all_p
.
name
)
for
all_p
in
parents
]
assert
B
in
parents
assert
(
A
.
id
,
A
.
name
)
in
parent_identifiers
assert
B2
in
parents
assert
(
B
.
id
,
B
.
name
)
in
parent_identifiers
assert
(
B2
.
id
,
B2
.
name
)
in
parent_identifiers
parents
=
c
.
get_parents_recursively
()
parents
=
c
.
get_parents_recursively
()
assert
len
(
parents
)
==
4
assert
len
(
parents
)
==
4
assert
A
in
parents
parent_identifiers
=
[(
all_p
.
id
,
all_p
.
name
)
for
all_p
in
parents
]
assert
B
in
parents
assert
(
A
.
id
,
A
.
name
)
in
parent_identifiers
assert
B2
in
parents
assert
(
B
.
id
,
B
.
name
)
in
parent_identifiers
assert
C
in
parents
assert
(
B2
.
id
,
B2
.
name
)
in
parent_identifiers
assert
(
C
.
id
,
C
.
name
)
in
parent_identifiers
# Now do a time travel and great-grand-parentize yourself...
# Now do a time travel and great-grand-parentize yourself...
A
.
add_parent
(
C
).
update
()
A
.
add_parent
(
C
).
update
()
parents
=
C
.
get_parents_recursively
()
parents
=
C
.
get_parents_recursively
()
assert
len
(
parents
)
==
4
assert
len
(
parents
)
==
4
assert
A
in
parents
parent_identifiers
=
[(
all_p
.
id
,
all_p
.
name
)
for
all_p
in
parents
]
assert
B
in
parents
assert
(
A
.
id
,
A
.
name
)
in
parent_identifiers
assert
B2
in
parents
assert
(
B
.
id
,
B
.
name
)
in
parent_identifiers
assert
C
in
parents
assert
(
B2
.
id
,
B2
.
name
)
in
parent_identifiers
assert
(
C
.
id
,
C
.
name
)
in
parent_identifiers
@pytest.mark.xfail
(
reason
=
"
To be fixed in server and/or pylib
"
)
#
@pytest.mark.xfail(reason="To be fixed in server and/or pylib")
def
test_entity_has_parent
():
def
test_entity_has_parent
():
# inheritance structure:
# inheritance structure:
# A
# 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