Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LHCb
Gaudi
Commits
e256ff86
Commit
e256ff86
authored
1 year ago
by
Marco Clemencic
Browse files
Options
Downloads
Patches
Plain Diff
Fix report of property name in exceptions for sequence and mapping semantics
parent
ae35fe76
No related branches found
No related tags found
No related merge requests found
Pipeline
#6187039
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiConfiguration/python/GaudiConfig2/semantics.py
+31
-1
31 additions, 1 deletion
GaudiConfiguration/python/GaudiConfig2/semantics.py
GaudiConfiguration/tests/python/test_error_conditions.py
+10
-1
10 additions, 1 deletion
GaudiConfiguration/tests/python/test_error_conditions.py
with
41 additions
and
2 deletions
GaudiConfiguration/python/GaudiConfig2/semantics.py
+
31
−
1
View file @
e256ff86
...
@@ -28,9 +28,17 @@ class PropertySemantics(object):
...
@@ -28,9 +28,17 @@ class PropertySemantics(object):
__handled_types__
=
()
__handled_types__
=
()
def
__init__
(
self
,
cpp_type
,
name
=
None
):
def
__init__
(
self
,
cpp_type
,
name
=
None
):
self
.
name
=
Non
e
self
.
_
name
=
nam
e
self
.
cpp_type
=
cpp_type
self
.
cpp_type
=
cpp_type
@property
def
name
(
self
):
return
self
.
_name
@name.setter
def
name
(
self
,
value
):
self
.
_name
=
value
@property
@property
def
cpp_type
(
self
):
def
cpp_type
(
self
):
return
self
.
_cpp_type
return
self
.
_cpp_type
...
@@ -341,6 +349,16 @@ class SequenceSemantics(PropertySemantics):
...
@@ -341,6 +349,16 @@ class SequenceSemantics(PropertySemantics):
self
.
value_semantics
=
valueSem
or
getSemanticsFor
(
self
.
value_semantics
=
valueSem
or
getSemanticsFor
(
list
(
extract_template_args
(
cpp_type
))[
0
]
list
(
extract_template_args
(
cpp_type
))[
0
]
)
)
self
.
value_semantics
.
name
=
name
@property
def
name
(
self
):
return
self
.
_name
@name.setter
def
name
(
self
,
value
):
self
.
_name
=
value
self
.
value_semantics
.
name
=
"
{} element
"
.
format
(
self
.
_name
)
def
store
(
self
,
value
):
def
store
(
self
,
value
):
new_value
=
_ListHelper
(
self
.
value_semantics
)
new_value
=
_ListHelper
(
self
.
value_semantics
)
...
@@ -464,7 +482,19 @@ class MappingSemantics(PropertySemantics):
...
@@ -464,7 +482,19 @@ class MappingSemantics(PropertySemantics):
super
(
MappingSemantics
,
self
).
__init__
(
cpp_type
,
name
)
super
(
MappingSemantics
,
self
).
__init__
(
cpp_type
,
name
)
template_args
=
list
(
extract_template_args
(
cpp_type
))
template_args
=
list
(
extract_template_args
(
cpp_type
))
self
.
key_semantics
=
getSemanticsFor
(
template_args
[
0
])
self
.
key_semantics
=
getSemanticsFor
(
template_args
[
0
])
self
.
key_semantics
.
name
=
"
{} key
"
.
format
(
name
)
self
.
value_semantics
=
getSemanticsFor
(
template_args
[
1
])
self
.
value_semantics
=
getSemanticsFor
(
template_args
[
1
])
self
.
value_semantics
.
name
=
"
{} value
"
.
format
(
name
)
@property
def
name
(
self
):
return
self
.
_name
@name.setter
def
name
(
self
,
value
):
self
.
_name
=
value
self
.
key_semantics
.
name
=
"
{} key
"
.
format
(
self
.
_name
)
self
.
value_semantics
.
name
=
"
{} value
"
.
format
(
self
.
_name
)
def
store
(
self
,
value
):
def
store
(
self
,
value
):
new_value
=
_DictHelper
(
self
.
key_semantics
,
self
.
value_semantics
)
new_value
=
_DictHelper
(
self
.
key_semantics
,
self
.
value_semantics
)
...
...
This diff is collapsed.
Click to expand it.
GaudiConfiguration/tests/python/test_error_conditions.py
+
10
−
1
View file @
e256ff86
...
@@ -12,8 +12,17 @@ import pytest
...
@@ -12,8 +12,17 @@ import pytest
def
test_1
():
def
test_1
():
from
GaudiConfig2.Configurables.TestConf
import
AlgWithVectors
from
GaudiConfig2.Configurables.TestConf
import
AlgWithMaps
,
AlgWithVectors
alg
=
AlgWithVectors
()
alg
=
AlgWithVectors
()
with
pytest
.
raises
(
TypeError
,
match
=
r
"
cannot set property VS .*
"
):
with
pytest
.
raises
(
TypeError
,
match
=
r
"
cannot set property VS .*
"
):
alg
.
VS
=
[
3
]
alg
.
VS
=
[
3
]
alg
=
AlgWithMaps
()
with
pytest
.
raises
(
TypeError
,
match
=
r
"
cannot set property MSS key .*
"
):
alg
.
MSS
[
3
]
=
"
value
"
with
pytest
.
raises
(
TypeError
,
match
=
r
"
cannot set property MSS value .*
"
):
alg
.
MSS
[
"
key
"
]
=
3
alg
.
MIV
[
3
]
=
[]
with
pytest
.
raises
(
TypeError
,
match
=
r
"
cannot set property MIV value element.*
"
):
alg
.
MIV
[
3
].
append
(
5
)
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