Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Adham Hashibon
force-bdss
Commits
ac2e65ac
Commit
ac2e65ac
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Changed exception when not found
parent
6297b43e
No related branches found
No related tags found
1 merge request
!60
Moved parameters into MCO
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
force_bdss/bundle_registry_plugin.py
+10
-10
10 additions, 10 deletions
force_bdss/bundle_registry_plugin.py
force_bdss/tests/test_bundle_registry_plugin.py
+25
-0
25 additions, 0 deletions
force_bdss/tests/test_bundle_registry_plugin.py
with
35 additions
and
10 deletions
force_bdss/bundle_registry_plugin.py
+
10
−
10
View file @
ac2e65ac
...
...
@@ -55,13 +55,13 @@ class BundleRegistryPlugin(Plugin):
Raises
------
Value
Error: if the entry is not found.
Key
Error: if the entry is not found.
"""
for
ds
in
self
.
data_source_bundles
:
if
ds
.
id
==
id
:
return
ds
raise
Value
Error
(
raise
Key
Error
(
"
Requested data source {} but don
'
t know how
"
"
to find it.
"
.
format
(
id
))
...
...
@@ -77,13 +77,13 @@ class BundleRegistryPlugin(Plugin):
Raises
------
Value
Error: if the entry is not found.
Key
Error: if the entry is not found.
"""
for
kpic
in
self
.
kpi_calculator_bundles
:
if
kpic
.
id
==
id
:
return
kpic
raise
Value
Error
(
raise
Key
Error
(
"
Requested kpi calculator {} but don
'
t know how
"
"
to find it.
"
.
format
(
id
))
...
...
@@ -99,14 +99,14 @@ class BundleRegistryPlugin(Plugin):
Raises
------
Value
Error: if the entry is not found.
Key
Error: if the entry is not found.
"""
for
mco
in
self
.
mco_bundles
:
if
mco
.
id
==
id
:
return
mco
raise
Value
Error
(
"
Requested MCO {} but don
'
t know how
"
"
to find it.
"
.
format
(
id
))
raise
Key
Error
(
"
Requested MCO {} but don
'
t know how
"
"
to find it.
"
.
format
(
id
))
def
mco_parameter_factory_by_id
(
self
,
mco_id
,
parameter_id
):
"""
Retrieves the MCO parameter factory for a given MCO id and
...
...
@@ -125,7 +125,7 @@ class BundleRegistryPlugin(Plugin):
Raises
------
Value
Error:
Key
Error:
if the entry is not found
"""
mco_bundle
=
self
.
mco_bundle_by_id
(
mco_id
)
...
...
@@ -134,5 +134,5 @@ class BundleRegistryPlugin(Plugin):
if
factory
.
id
==
parameter_id
:
return
factory
raise
Value
Error
(
"
Requested MCO parameter {}:{} but don
'
t know
"
"
how to find it.
"
.
format
(
mco_id
,
parameter_id
))
raise
Key
Error
(
"
Requested MCO parameter {}:{} but don
'
t know
"
"
how to find it.
"
.
format
(
mco_id
,
parameter_id
))
This diff is collapsed.
Click to expand it.
force_bdss/tests/test_bundle_registry_plugin.py
+
25
−
0
View file @
ac2e65ac
...
...
@@ -89,6 +89,31 @@ class TestBundleRegistryWithContent(unittest.TestCase):
self
.
assertEqual
(
self
.
plugin
.
kpi_calculator_bundle_by_id
(
id
).
id
,
id
)
with
self
.
assertRaises
(
KeyError
):
self
.
plugin
.
mco_bundle_by_id
(
bundle_id
(
"
enthought
"
,
"
foo
"
))
with
self
.
assertRaises
(
KeyError
):
self
.
plugin
.
mco_parameter_factory_by_id
(
mco_id
,
mco_parameter_id
(
"
enthought
"
,
"
mco1
"
,
"
foo
"
)
)
with
self
.
assertRaises
(
KeyError
):
self
.
plugin
.
data_source_bundle_by_id
(
bundle_id
(
"
enthought
"
,
"
foo
"
)
)
with
self
.
assertRaises
(
KeyError
):
self
.
plugin
.
data_source_bundle_by_id
(
bundle_id
(
"
enthought
"
,
"
foo
"
)
)
with
self
.
assertRaises
(
KeyError
):
self
.
plugin
.
kpi_calculator_bundle_by_id
(
bundle_id
(
"
enthought
"
,
"
foo
"
)
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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