Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix YAML tests don't fill Simulation.input_variables #122 #123

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Bug causing YAML tests to not populate `Simulation.input_variables`.
13 changes: 11 additions & 2 deletions policyengine_core/simulations/simulation_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,23 @@ def build_from_dict(
key in tax_benefit_system.entities_plural()
for key in input_dict.keys()
):
return self.build_from_entities(
simulation = self.build_from_entities(
tax_benefit_system, input_dict, simulation
)
else:
return self.build_from_variables(
simulation = self.build_from_variables(
tax_benefit_system, input_dict, simulation
)

simulation.input_variables = [
variable.name
for variable in simulation.tax_benefit_system.variables.values()
if len(simulation.get_holder(variable.name).get_known_periods())
> 0
]

return simulation

def build_from_entities(
self,
tax_benefit_system: "TaxBenefitSystem",
Expand Down