Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
seda
Commits
878d52c2453e
Commit
6abe1b33
authored
Oct 22, 2021
by
Katia Saurfelt
Browse files
feat: schema validation, add choice + zeroOrMore for DataObjectGroup (closes
#35
)
--HG-- branch : seda21
parent
da9c60e6a4c7
Pipeline
#89644
failed with stages
in 2 minutes and 37 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
cubicweb_seda/entities/profile_generation.py
View file @
878d52c2
...
...
@@ -757,11 +757,13 @@ class SEDA22RelaxNGExport(SEDA2RelaxNGExport):
if
nodes
or
opt_nodes
:
# insert after definition of dop's id attribute
for
node
in
chain
(
nodes
,
opt_nodes
):
zeroormore
=
self
.
element
(
"rng:zeroOrMore"
)
choice
=
self
.
element
(
"rng:choice"
,
zeroormore
)
dop
[
0
].
addnext
(
zeroormore
)
# insert DataObjectGroup
group
=
self
.
element
(
"rng:element"
,
attributes
=
{
"name"
:
"DataObjectGroup"
}
"rng:element"
,
choice
,
attributes
=
{
"name"
:
"DataObjectGroup"
}
)
dop
[
0
].
addnext
(
group
)
group
.
append
(
node
)
...
...
test/test_profile_generation.py
View file @
878d52c2
...
...
@@ -534,7 +534,7 @@ class SEDA2RNGExportTC(RelaxNGTestMixin, CubicWebTC):
profile
=
self
.
profile_etree
(
transfer
)
dop
=
self
.
get_element
(
profile
,
"DataObjectPackage"
)
self
.
assertEqual
(
len
(
self
.
xpath
(
dop
,
'./rng:element[@name="DataObjectGroup"]/*'
)),
3
len
(
self
.
xpath
(
dop
,
'./rng:
zeroOrMore/rng:choice/rng:
element[@name="DataObjectGroup"]/*'
)),
3
)
# setting some cardinality to 1 will remove rng:optional parent of the DataObjectPackage
# and BinaryDataObject nodes
...
...
@@ -542,7 +542,7 @@ class SEDA2RNGExportTC(RelaxNGTestMixin, CubicWebTC):
profile
=
self
.
profile_etree
(
transfer
)
dop
=
self
.
get_element
(
profile
,
"DataObjectPackage"
)
self
.
assertEqual
(
len
(
self
.
xpath
(
dop
,
'./rng:element[@name="DataObjectGroup"]/*'
)),
3
len
(
self
.
xpath
(
dop
,
'./rng:
zeroOrMore/rng:choice/rng:
element[@name="DataObjectGroup"]/*'
)),
3
)
def
test_transfer_annotation
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment