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
4c3cd343
Verified
Commit
4c3cd343
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
FIX: YAML parser: Descriptions are honored now for list properties.
parent
526b634d
No related branches found
No related tags found
2 merge requests
!89
ENH: JsonSchemaExporter accepts do_not_create parameter.
,
!88
jsex / yaml parser
Pipeline
#44122
failed
1 year ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/models/parser.py
+8
-3
8 additions, 3 deletions
src/caosadvancedtools/models/parser.py
unittests/test_yaml_model_parser.py
+5
-2
5 additions, 2 deletions
unittests/test_yaml_model_parser.py
with
13 additions
and
5 deletions
src/caosadvancedtools/models/parser.py
+
8
−
3
View file @
4c3cd343
...
...
@@ -533,9 +533,13 @@ debug : bool, optional
if
not
isinstance
(
definition
,
dict
):
return
if
(
"
datatype
"
in
definition
and
definition
[
"
datatype
"
].
startswith
(
"
LIST
"
)):
# These definition items must be handled even for list props.
for
prop_name
,
prop
in
definition
.
items
():
if
prop_name
==
"
description
"
:
self
.
model
[
name
].
description
=
prop
# For lists, everything else is not needed at this level.
if
(
"
datatype
"
in
definition
and
definition
[
"
datatype
"
].
startswith
(
"
LIST
"
)):
return
if
name
in
self
.
treated
:
...
...
@@ -553,7 +557,8 @@ debug : bool, optional
self
.
model
[
name
].
value
=
prop
elif
prop_name
==
"
description
"
:
self
.
model
[
name
].
description
=
prop
# Handled above
continue
elif
prop_name
==
"
recommended_properties
"
:
self
.
_add_to_recordtype
(
...
...
This diff is collapsed.
Click to expand it.
unittests/test_yaml_model_parser.py
+
5
−
2
View file @
4c3cd343
...
...
@@ -21,7 +21,7 @@ from datetime import date
from
tempfile
import
NamedTemporaryFile
from
pytest
import
deprecated_call
,
raises
,
mark
import
caosdb
as
db
import
linkahead
as
db
from
caosadvancedtools.models.parser
import
(
TwiceDefinedException
,
YamlDefinitionError
,
parse_model_from_string
,
...
...
@@ -302,10 +302,12 @@ A:
def
test_reference_property
(
self
):
"""
Test correct creation of reference property using an RT.
"""
modeldef
=
"""
A:
modeldef
=
"""
A:
recommended_properties:
ref:
datatype: LIST<A>
description: new description
"""
model
=
parse_model_from_string
(
modeldef
)
self
.
assertEqual
(
len
(
model
),
2
)
...
...
@@ -315,6 +317,7 @@ A:
elif
key
==
"
ref
"
:
self
.
assertTrue
(
isinstance
(
value
,
db
.
Property
))
self
.
assertEqual
(
value
.
datatype
,
"
LIST<A>
"
)
assert
value
.
description
==
"
new description
"
class
ExternTest
(
unittest
.
TestCase
):
...
...
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