Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
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-pylib
Commits
3af22cc5
Commit
3af22cc5
authored
3 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add unittests for
https://gitlab.com/linkahead/linkahead-pylib/-/issues/119
parent
593a3acb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!175
BUG: Request responses without the "Set-Cookie" header no longer overwrite the...
,
!165
Compare_entities diff uses id instead of name where needed
Pipeline
#58572
passed
3 months ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_apiutils.py
+28
-0
28 additions, 0 deletions
unittests/test_apiutils.py
with
28 additions
and
0 deletions
unittests/test_apiutils.py
+
28
−
0
View file @
3af22cc5
...
...
@@ -991,3 +991,31 @@ def test_describe_diff():
assert
"
first
"
not
in
diffout
assert
"
second
"
not
in
diffout
def
test_diff_without_names
():
"""
Test compare_entities in case of properties and parents with
ids and without names
(cf. https://gitlab.com/linkahead/linkahead-pylib/-/issues/119).
"""
r1
=
db
.
Record
(
name
=
"
Test
"
).
add_parent
(
name
=
"
TestType
"
)
r2
=
db
.
Record
(
name
=
"
Test
"
).
add_parent
(
name
=
"
TestType
"
)
r2
.
add_property
(
id
=
123
,
value
=
"
Test
"
)
diff1
,
diff2
=
compare_entities
(
r1
,
r2
)
assert
len
(
diff1
[
"
properties
"
])
==
0
assert
len
(
diff2
[
"
properties
"
])
==
1
assert
123
in
diff2
[
"
properties
"
]
assert
None
not
in
diff2
[
"
properties
"
]
r3
=
db
.
Record
().
add_parent
(
id
=
101
)
r4
=
db
.
Record
().
add_parent
(
id
=
102
)
diff3
,
diff4
=
compare_entities
(
r3
,
r4
)
assert
len
(
diff3
[
"
parents
"
])
==
1
assert
101
in
diff3
[
"
parents
"
]
assert
None
not
in
diff3
[
"
parents
"
]
assert
len
(
diff4
[
"
parents
"
])
==
1
assert
102
in
diff4
[
"
parents
"
]
assert
None
not
in
diff3
[
"
parents
"
]
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