diff --git a/docs/contributing/dependencies.md b/docs/contributing/dependencies.md index 39091d701..efc71b8d3 100644 --- a/docs/contributing/dependencies.md +++ b/docs/contributing/dependencies.md @@ -3,7 +3,7 @@ ## Python Tax-Calculator currently runs on Python 3.9, 3.10, 3.11, and 3.12. -We generally support at least three of the latest major Python releases. +We generally support at least the three latest major Python releases. Updating the Python version requires modifying the following files: * `.github/workflows/*.yml` diff --git a/taxcalc/calculator.py b/taxcalc/calculator.py index 3481afb80..af2abbd84 100644 --- a/taxcalc/calculator.py +++ b/taxcalc/calculator.py @@ -120,21 +120,17 @@ def __init__(self, policy=None, records=None, verbose=False, print(' ' + var) current_year_is_data_year = ( - self.__records.current_year == self.__records.data_year - ) - extrapolating = self.__records.current_year > self.__records.data_year + self.__records.current_year == self.__records.data_year) if sync_years and current_year_is_data_year: if verbose: print('You loaded data for ' + str(self.__records.data_year) + '.') while self.__records.current_year < self.__policy.current_year: self.__records.increment_year() - if verbose and extrapolating: - print( # pragma: no cover - 'Tax-Calculator startup automatically ' + - 'extrapolated your data to ' + - str(self.__records.current_year) + '.' - ) + if verbose: + print('Tax-Calculator startup automatically ' + + 'extrapolated your data to ' + + str(self.__records.current_year) + '.') else: if verbose: print('Tax-Calculator startup did not ' + diff --git a/taxcalc/growfactors.py b/taxcalc/growfactors.py index 70e5f6b3b..336d8ae74 100644 --- a/taxcalc/growfactors.py +++ b/taxcalc/growfactors.py @@ -165,7 +165,6 @@ def update(self, name, year, diff): msg = 'cannot update growfactors after they have been used' raise ValueError(msg) assert name in GrowFactors.VALID_NAMES - assert year >= self.first_year - assert year <= self.last_year - assert isinstance(diff, float) - self.gfdf.loc[year, name] += diff + if year >= self.first_year and year <= self.last_year: + assert isinstance(diff, float) + self.gfdf.loc[year, name] += diff diff --git a/taxcalc/records.py b/taxcalc/records.py index c5a6fce88..01c4e87e6 100644 --- a/taxcalc/records.py +++ b/taxcalc/records.py @@ -227,6 +227,7 @@ def cps_constructor(data=None, @staticmethod def tmd_constructor(data, # path to tmd.csv file or dataframe + gfactors=TMD_GROWFACTORS_FILENAME, exact_calculations=False): # pragma: no cover """ Static method returns a Records object instantiated with TMD @@ -241,7 +242,7 @@ def tmd_constructor(data, # path to tmd.csv file or dataframe weights = os.path.join(Records.CODE_PATH, Records.TMD_WEIGHTS_FILENAME) return Records(data=data, start_year=Records.TMDCSV_YEAR, - gfactors=Records.TMD_GROWFACTORS_FILENAME, + gfactors=gfactors, weights=weights, adjust_ratios=Records.TMD_RATIOS_FILENAME, exact_calculations=exact_calculations)