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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
ddb04d91
Commit
ddb04d91
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
FIX: revert usage of main lib has_parent
parent
0e6af72e
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!69
Release v0.7.0
,
!67
F fix has parent
Pipeline
#33905
passed
2 years ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_yaml_model_parser.py
+13
-5
13 additions, 5 deletions
unittests/test_yaml_model_parser.py
with
13 additions
and
5 deletions
unittests/test_yaml_model_parser.py
+
13
−
5
View file @
ddb04d91
...
...
@@ -32,6 +32,14 @@ def has_property(el, name):
return
False
def
has_parent
(
el
,
name
):
for
p
in
el
.
get_parents
():
if
p
.
name
==
name
:
return
True
return
False
class
TwiceTest
(
unittest
.
TestCase
):
def
test_defined_once
(
self
):
string
=
"""
...
...
@@ -140,16 +148,16 @@ RT4:
RT5:
"""
model
=
parse_model_from_yaml
(
to_file
(
string
))
assert
model
[
"
RT1
"
]
.
has_parent
(
"
RT2
"
,
retrieve
=
False
)
assert
has_parent
(
model
[
"
RT1
"
]
,
"
RT2
"
)
assert
(
model
[
"
RT1
"
].
get_parent
(
"
RT2
"
).
_flags
[
"
inheritance
"
]
==
db
.
SUGGESTED
)
assert
model
[
"
RT1
"
]
.
has_parent
(
"
RT3
"
,
retrieve
=
False
)
assert
has_parent
(
model
[
"
RT1
"
]
,
"
RT3
"
)
assert
(
model
[
"
RT1
"
].
get_parent
(
"
RT3
"
).
_flags
[
"
inheritance
"
]
==
db
.
RECOMMENDED
)
assert
model
[
"
RT1
"
]
.
has_parent
(
"
RT4
"
,
retrieve
=
False
)
assert
has_parent
(
model
[
"
RT1
"
]
,
"
RT4
"
)
assert
(
model
[
"
RT1
"
].
get_parent
(
"
RT4
"
).
_flags
[
"
inheritance
"
]
==
db
.
OBLIGATORY
)
assert
model
[
"
RT1
"
]
.
has_parent
(
"
RT5
"
,
retrieve
=
False
)
assert
has_parent
(
model
[
"
RT1
"
]
,
"
RT5
"
)
assert
(
model
[
"
RT1
"
].
get_parent
(
"
RT5
"
).
_flags
[
"
inheritance
"
]
==
db
.
OBLIGATORY
)
...
...
@@ -501,5 +509,5 @@ R3:
assert
isinstance
(
r3
,
db
.
RecordType
)
for
par
in
[
"
R1
"
,
"
R2
"
]:
# Until removal, both do the same
assert
r3
.
has_parent
(
par
,
retrieve
=
False
)
assert
has_parent
(
r3
,
par
)
assert
r3
.
get_parent
(
par
).
_flags
[
"
inheritance
"
]
==
db
.
OBLIGATORY
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