diff --git a/RELEASES.md b/RELEASES.md index abd9df8e2..01696ad4c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -29,7 +29,9 @@ Release 0.12.0 on 2017-??-?? by Martin Holmer] **Bug Fixes** -- None +- Relax _STD and _STD_Dep minimum value warning logic + [[#1578](https://github.com/open-source-economics/Tax-Calculator/pull/1578) + by Martin Holmer] Release 0.11.0 on 2017-09-21 ---------------------------- diff --git a/taxcalc/policy.py b/taxcalc/policy.py index 99d352585..9ffb6f748 100644 --- a/taxcalc/policy.py +++ b/taxcalc/policy.py @@ -376,6 +376,8 @@ def _validate_parameter_values(self, parameters_set): # pylint: disable=too-many-locals # pylint: disable=too-many-branches # pylint: disable=too-many-nested-blocks + rounding_error = 100.0 + # above handles non-rounding of inflation-indexed parameter values clp = self.current_law_version() parameters = sorted(parameters_set) syr = Policy.JSON_START_YEAR @@ -387,6 +389,10 @@ def _validate_parameter_values(self, parameters_set): if isinstance(vval, six.string_types): if vval == 'default': vvalue = getattr(clp, pname) + if vop == 'min': + vvalue -= rounding_error + elif vop == 'max': + vvalue += rounding_error else: vvalue = getattr(self, vval) else: diff --git a/taxcalc/tests/test_policy.py b/taxcalc/tests/test_policy.py index 8f3d198b4..bdcb0a08a 100644 --- a/taxcalc/tests/test_policy.py +++ b/taxcalc/tests/test_policy.py @@ -798,13 +798,17 @@ def test_range_infomation(tests_path): range = param.get('range', None) if range: json_range_params.add(pname) - assert param['out_of_range_action'] in warn_stop_list + oor_action = param['out_of_range_action'] + assert oor_action in warn_stop_list range_items = range.items() assert len(range_items) == 2 for vop, vval in range_items: assert vop in min_max_list if isinstance(vval, six.string_types): if vval == 'default': + if vop != 'min' or oor_action != 'warn': + msg = 'USES DEFAULT FOR min OR FOR error' + assert pname == msg continue elif vval in clpdict: if vop == 'min': @@ -880,6 +884,14 @@ def test_validate_param_values_warnings_errors(): ref6 = {2026: {'_ID_BenefitSurtax_Switch': [[False, True, 0, 2, 0, 1, 0]]}} pol6.implement_reform(ref6) assert len(pol6.reform_errors) > 0 + # raise stdded for everybody but widows, leaving widow value unchanged, + # which is the logic TaxBrain has been using at least until 2017-10-05 + # when this "7" test was added + pol7 = Policy() + ref7 = {2013: {'_STD': [[20000, 20000, 20000, 20000, 12200]]}} + pol7.implement_reform(ref7) + assert pol7.reform_errors == '' + assert pol7.reform_warnings == '' def test_indexing_rates_for_update():