diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..ae01f95b 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Bug causing YAML tests to not populate `Simulation.input_variables`. diff --git a/policyengine_core/simulations/simulation_builder.py b/policyengine_core/simulations/simulation_builder.py index 5f6835d0..b39e953f 100644 --- a/policyengine_core/simulations/simulation_builder.py +++ b/policyengine_core/simulations/simulation_builder.py @@ -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",