Skip to content

Commit

Permalink
instantiating an Evaluator without one or more AbstractModel instance…
Browse files Browse the repository at this point in the history
…s now raises a type error
  • Loading branch information
quaquel committed May 30, 2022
1 parent b5a9ca9 commit a83533a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ema_workbench/em_framework/evaluators.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ def __init__(self, msis):

if isinstance(msis, AbstractModel):
msis = [msis]
else:
for entry in msis:
if not isinstance(entry, AbstractModel):
raise TypeError((f"{entry} should be an AbstractModel "
f"instance but is a {entry.__class__} instance"))

self._msis = msis
self.callback = None
Expand Down Expand Up @@ -274,7 +279,6 @@ def robust_optimize(


class SequentialEvaluator(BaseEvaluator):

def initialize(self):
pass

Expand Down Expand Up @@ -790,4 +794,4 @@ def robust_optimize(
convergence_freq,
logging_freq,
**kwargs,
)
)

1 comment on commit a83533a

@EwoutH
Copy link
Collaborator

@EwoutH EwoutH commented on a83533a May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, its a very useful place to throw an error!

Please sign in to comment.