Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Rosen Matev
Gaudi
Commits
672c80ae
There was a problem fetching the pipeline summary.
Commit
672c80ae
authored
6 years ago
by
Rosen Matev
Browse files
Options
Downloads
Patches
Plain Diff
Handle incompatible values for DataObjectHandleBase props
Fixes
gaudi/Gaudi#22
parent
2ca77dcb
No related branches found
Branches containing commit
Tags
v52r0
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 @
672c80ae
...
@@ -393,6 +393,9 @@ class DataObjectHandleBasePropertyProxy(PropertyProxy):
...
@@ -393,6 +393,9 @@ class DataObjectHandleBasePropertyProxy(PropertyProxy):
return
DataObjectHandleBase
(
value
)
return
DataObjectHandleBase
(
value
)
elif
isinstance
(
value
,
DataObjectHandleBase
):
elif
isinstance
(
value
,
DataObjectHandleBase
):
return
DataObjectHandleBase
(
value
.
__str__
())
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
):
def
PropertyProxyFactory
(
descr
,
doc
,
default
):
...
...
This diff is collapsed.
Click to expand it.
GaudiKernel/tests/nose/test_Configurables.py
+
18
−
2
View file @
672c80ae
# Prepare dummy configurables
# Prepare dummy configurables
from
GaudiKernel.Configurable
import
ConfigurableAlgorithm
,
Configurable
from
GaudiKernel.Configurable
import
ConfigurableAlgorithm
,
Configurable
from
GaudiKernel.DataObjectHandleBase
import
DataObjectHandleBase
class
MyAlg
(
ConfigurableAlgorithm
):
class
MyAlg
(
ConfigurableAlgorithm
):
__slots__
=
{
'
Text
'
:
'
some text
'
,
__slots__
=
{
'
Text
'
:
'
some text
'
,
'
Int
'
:
23
}
'
Int
'
:
23
,
'
DataHandle
'
:
DataObjectHandleBase
(
'
Location
'
)}
def
getDlls
(
self
):
def
getDlls
(
self
):
return
'
Dummy
'
return
'
Dummy
'
...
@@ -26,7 +28,10 @@ def test_correct():
...
@@ -26,7 +28,10 @@ def test_correct():
a
=
MyAlg
()
a
=
MyAlg
()
a
.
Int
=
42
a
.
Int
=
42
a
.
Text
=
'
value
'
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
():
def
test_invalid_value
():
...
@@ -53,6 +58,17 @@ def test_invalid_value():
...
@@ -53,6 +58,17 @@ def test_invalid_value():
assert
False
,
'
ValueError exception expected, got %s
'
%
type
(
assert
False
,
'
ValueError exception expected, got %s
'
%
type
(
x
).
__name__
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
():
def
test_invalid_key
():
a
=
MyAlg
()
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