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
a926b34a
Commit
a926b34a
authored
3 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Plain Diff
Changes to the `Configurable` method `merge`
See merge request
!1319
parents
6adec3a7
e8d80311
No related branches found
No related tags found
1 merge request
!1319
Changes to the `Configurable` method `merge`
Pipeline
#3758894
canceled
3 years ago
Stage: pre-build-checks
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiConfiguration/python/GaudiConfig2/_configurables.py
+7
-2
7 additions, 2 deletions
GaudiConfiguration/python/GaudiConfig2/_configurables.py
GaudiConfiguration/tests/nose/test_configurables_merge.py
+6
-0
6 additions, 0 deletions
GaudiConfiguration/tests/nose/test_configurables_merge.py
with
13 additions
and
2 deletions
GaudiConfiguration/python/GaudiConfig2/_configurables.py
+
7
−
2
View file @
a926b34a
...
...
@@ -281,6 +281,8 @@ class Configurable(ConfigMetaHelper):
(or both unnamed) and the settings must be mergable (according to
their semantics).
"""
if
self
is
other
:
return
self
if
type
(
self
)
is
not
type
(
other
):
raise
TypeError
(
"
cannot merge instance of {} into an instance of {}
"
.
format
(
...
...
@@ -296,8 +298,11 @@ class Configurable(ConfigMetaHelper):
)
)
for
name
in
other
.
_descriptors
:
if
not
other
.
is_property_set
(
name
):
for
name
in
other
.
_properties
:
if
(
name
in
self
.
_properties
and
self
.
_properties
[
name
]
==
other
.
_properties
[
name
]
):
continue
try
:
setattr
(
...
...
This diff is collapsed.
Click to expand it.
GaudiConfiguration/tests/nose/test_configurables_merge.py
+
6
−
0
View file @
a926b34a
...
...
@@ -23,6 +23,12 @@ def teardown_func():
useGlobalInstances
(
False
)
def
test_merge_identical
():
a
=
MyAlg
(
"
ThisAlg
"
,
AnIntProp
=
42
)
a
.
merge
(
a
)
assert
a
.
AnIntProp
==
42
def
test_merge
():
a
=
MyAlg
(
"
ThisAlg
"
,
AnIntProp
=
42
)
b
=
MyAlg
(
"
ThisAlg
"
,
AStringProp
=
"
42
"
)
...
...
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