Skip to content

Commit

Permalink
Fix bug in reform handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Sep 24, 2024
1 parent aa234c7 commit 8bfcd1a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions policyengine_core/simulations/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __init__(
self.tax_benefit_system.simulation = self

if self.reform is not None:
self.tax_benefit_system.apply_reform_set(self.reform)
self.apply_reform(self.reform)

Check warning on line 171 in policyengine_core/simulations/simulation.py

View check run for this annotation

Codecov / codecov/patch

policyengine_core/simulations/simulation.py#L171

Added line #L171 was not covered by tests

# Backwards compatibility methods
self.calc = self.calculate
Expand Down Expand Up @@ -1470,7 +1470,7 @@ def to_input_dataframe(
return df

def subsample(
self, n=None, frac=None, key=None, time_period=None, reform=None
self, n=None, frac=None, key=None, time_period=None
) -> "Simulation":
"""Quantize the simulation to a smaller size by sampling households.
Expand All @@ -1479,7 +1479,6 @@ def subsample(
frac (float, optional): The fraction of households to sample. Defaults to None.
key (int, optional): The key used to seed the random number generator. Defaults to the dataset name.
time_period (str, optional): Sample households based on their weight in this time period. Defaults to the default calculation period.
reform (Reform, optional): The reform to apply to the quantized simulation. Defaults to None.
Returns:
Simulation: The quantized simulation.
Expand Down Expand Up @@ -1541,7 +1540,6 @@ def subsample(
# Update the dataset and rebuild the simulation
self.dataset = Dataset.from_dataframe(df)
self.build_from_dataset()

return self

Check warning on line 1543 in policyengine_core/simulations/simulation.py

View check run for this annotation

Codecov / codecov/patch

policyengine_core/simulations/simulation.py#L1541-L1543

Added lines #L1541 - L1543 were not covered by tests


Expand Down

0 comments on commit 8bfcd1a

Please sign in to comment.