Ensure every instance of Simulation
class has dataset
, fix check_macro_cache
#266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #262.
Previously, the
Simulation
class took an optional argument defaulted toNone
for adataset
parameter, which was used only when extendingSimulation
into classes likeMicroSimulation
and was always created with a default value ofNone
if not provided. If adataset
was provided, it appears to have correctly integrated that into theSimulation
instance. However, a dataset is not always provided, particularly bype-core
's test runner, which does not provide one.This creates a confusing behavior whereby the
dataset
argument is always present, but an individualSimulation
instance'sself.dataset
property is only created whendataset
is notNone
. Furthermore, there are times when it appearsself.dataset
is created, but made equal toNone
. Furthermore, it's fairly easy to confuse theself.dataset
instance attribute with theself.datasets
class attribute, which is always present.In order to disambiguate, this PR always instantiates a
self.dataset
instance attribute based upon thedataset
arg, which continues to have a default value ofNone
. Relying upon the expectation thatself.dataset
is always defined, it modifies theself.check_macro_cache
method, but also adds a safety valve check to properly returnFalse
ifself.dataset
does not exist, just in case this PR missed some behavior somewhere.