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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
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
Gaudi
Gaudi
Commits
c0fdddd5
There was a problem fetching the pipeline summary.
Commit
c0fdddd5
authored
6 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Plain Diff
Handle incompatible values for DataObjectHandleBase props (mr !654)
Backport of !650
parents
e00bb2f2
f6ecadc9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiKernel/python/GaudiKernel/PropertyProxy.py
+3
-0
3 additions, 0 deletions
GaudiKernel/python/GaudiKernel/PropertyProxy.py
GaudiKernel/tests/nose/test_Configurables.py
+18
-2
18 additions, 2 deletions
GaudiKernel/tests/nose/test_Configurables.py
with
21 additions
and
2 deletions
GaudiKernel/python/GaudiKernel/PropertyProxy.py
+
3
−
0
View file @
c0fdddd5
...
...
@@ -385,6 +385,9 @@ class DataObjectHandleBasePropertyProxy(PropertyProxy):
return
DataObjectHandleBase
(
value
)
elif
isinstance
(
value
,
DataObjectHandleBase
):
return
DataObjectHandleBase
(
value
.
__str__
())
else
:
raise
ValueError
(
"
received an instance of %s, but %s expected
"
%
(
type
(
value
),
'
str or DataObjectHandleBase
'
))
def
PropertyProxyFactory
(
descr
,
doc
,
default
):
...
...
This diff is collapsed.
Click to expand it.
GaudiKernel/tests/nose/test_Configurables.py
+
18
−
2
View file @
c0fdddd5
# Prepare dummy configurables
from
GaudiKernel.Configurable
import
ConfigurableAlgorithm
,
Configurable
from
GaudiKernel.DataObjectHandleBase
import
DataObjectHandleBase
class
MyAlg
(
ConfigurableAlgorithm
):
__slots__
=
{
'
Text
'
:
'
some text
'
,
'
Int
'
:
23
}
'
Int
'
:
23
,
'
DataHandle
'
:
DataObjectHandleBase
(
'
Location
'
)}
def
getDlls
(
self
):
return
'
Dummy
'
...
...
@@ -26,7 +28,10 @@ def test_correct():
a
=
MyAlg
()
a
.
Int
=
42
a
.
Text
=
'
value
'
assert
a
.
getValuedProperties
()
==
{
'
Int
'
:
42
,
'
Text
'
:
'
value
'
}
a
.
DataHandle
=
'
/Event/X
'
assert
a
.
getValuedProperties
()
==
{
'
Int
'
:
42
,
'
Text
'
:
'
value
'
,
'
DataHandle
'
:
DataObjectHandleBase
(
'
/Event/X
'
)}
def
test_invalid_value
():
...
...
@@ -53,6 +58,17 @@ def test_invalid_value():
assert
False
,
'
ValueError exception expected, got %s
'
%
type
(
x
).
__name__
try
:
a
.
DataHandle
=
[
123
]
assert
False
,
'
exception expected
'
except
AssertionError
:
raise
except
ValueError
:
pass
except
Exception
,
x
:
assert
False
,
'
ValueError exception expected, got %s
'
%
type
(
x
).
__name__
def
test_invalid_key
():
a
=
MyAlg
()
...
...
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