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
18ccd72d
Commit
18ccd72d
authored
7 months ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST(data-model-parser): replaced static xml tests by more specific ones
parent
0c25885d
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!128
MNT: Added a warning when column metadata is not configured, and a better...
,
!115
add datatype, unit and description to properties that are part of Records
Pipeline
#57814
failed
7 months 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
+14
-18
14 additions, 18 deletions
unittests/test_yaml_model_parser.py
with
14 additions
and
18 deletions
unittests/test_yaml_model_parser.py
+
14
−
18
View file @
18ccd72d
...
@@ -612,14 +612,13 @@ RT2:
...
@@ -612,14 +612,13 @@ RT2:
obligatory_properties: *RT1_oblig
obligatory_properties: *RT1_oblig
"""
"""
model
=
parse_model_from_string
(
model_string
)
model
=
parse_model_from_string
(
model_string
)
assert
str
(
model
)
==
"""
{
'
foo
'
: <Property name=
"
foo
"
datatype=
"
INTEGER
"
/>
,
'
RT1
'
: <RecordType name=
"
RT1
"
>
assert
len
(
model
)
==
3
<Property name=
"
foo
"
importance=
"
OBLIGATORY
"
flag=
"
inheritance:FIX
"
/>
assert
isinstance
(
model
[
"
foo
"
],
db
.
Property
)
</RecordType>
assert
model
[
"
foo
"
].
datatype
==
db
.
INTEGER
,
'
RT2
'
: <RecordType name=
"
RT2
"
>
for
st
in
(
"
RT1
"
,
"
RT2
"
):
<Property name=
"
foo
"
importance=
"
OBLIGATORY
"
flag=
"
inheritance:FIX
"
/>
assert
isinstance
(
model
[
st
],
db
.
RecordType
)
</RecordType>
assert
model
[
st
].
get_property
(
"
foo
"
).
datatype
==
db
.
INTEGER
}
"""
# Aliasing with override
# Aliasing with override
model_string
=
"""
model_string
=
"""
...
@@ -634,16 +633,13 @@ RT2:
...
@@ -634,16 +633,13 @@ RT2:
bar:
bar:
"""
"""
model
=
parse_model_from_string
(
model_string
)
model
=
parse_model_from_string
(
model_string
)
assert
str
(
model
)
==
"""
{
'
foo
'
: <Property name=
"
foo
"
datatype=
"
INTEGER
"
/>
,
'
RT1
'
: <RecordType name=
"
RT1
"
>
assert
len
(
model
)
==
4
<Property name=
"
foo
"
importance=
"
OBLIGATORY
"
flag=
"
inheritance:FIX
"
/>
assert
isinstance
(
model
[
"
bar
"
],
db
.
RecordType
)
</RecordType>
for
st
in
(
"
RT1
"
,
"
RT2
"
):
,
'
RT2
'
: <RecordType name=
"
RT2
"
>
assert
isinstance
(
model
[
st
],
db
.
RecordType
)
<Property name=
"
foo
"
importance=
"
OBLIGATORY
"
flag=
"
inheritance:FIX
"
/>
assert
model
[
st
].
get_property
(
"
foo
"
).
datatype
==
db
.
INTEGER
<Property name=
"
bar
"
importance=
"
OBLIGATORY
"
flag=
"
inheritance:FIX
"
/>
assert
model
[
"
RT2
"
].
get_property
(
"
bar
"
).
datatype
==
"
bar
"
</RecordType>
,
'
bar
'
: <RecordType name=
"
bar
"
/>
}
"""
def
test_comparison_yaml_model
(
capfd
):
def
test_comparison_yaml_model
(
capfd
):
...
...
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