taxcalc 4.3.5__py3-none-any.whl → 4.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taxcalc/__init__.py +1 -1
- taxcalc/calcfunctions.py +326 -171
- taxcalc/calculator.py +35 -34
- taxcalc/cli/tc.py +6 -7
- taxcalc/consumption.py +14 -9
- taxcalc/data.py +8 -8
- taxcalc/decorators.py +3 -3
- taxcalc/growdiff.py +6 -6
- taxcalc/growfactors.py +1 -1
- taxcalc/parameters.py +91 -47
- taxcalc/policy.py +23 -7
- taxcalc/records.py +1 -0
- taxcalc/records_variables.json +6 -0
- taxcalc/reforms/ext.json +1 -1
- taxcalc/taxcalcio.py +88 -73
- taxcalc/tests/cmpi_cps_expect.txt +6 -6
- taxcalc/tests/cmpi_puf_expect.txt +6 -6
- taxcalc/tests/conftest.py +42 -41
- taxcalc/tests/test_4package.py +47 -3
- taxcalc/tests/test_benefits.py +9 -8
- taxcalc/tests/test_calcfunctions.py +55 -38
- taxcalc/tests/test_calculator.py +14 -10
- taxcalc/tests/test_compare.py +44 -50
- taxcalc/tests/test_compatible_data.py +9 -7
- taxcalc/tests/test_consumption.py +41 -22
- taxcalc/tests/test_cpscsv.py +81 -31
- taxcalc/tests/test_data.py +31 -24
- taxcalc/tests/test_decorators.py +84 -32
- taxcalc/tests/test_growdiff.py +20 -19
- taxcalc/tests/test_growfactors.py +8 -8
- taxcalc/tests/test_parameters.py +54 -58
- taxcalc/tests/test_policy.py +16 -14
- taxcalc/tests/test_puf_var_stats.py +14 -14
- taxcalc/tests/test_pufcsv.py +40 -40
- taxcalc/tests/test_records.py +73 -60
- taxcalc/tests/test_reforms.py +34 -31
- taxcalc/tests/test_responses.py +4 -4
- taxcalc/tests/test_taxcalcio.py +76 -62
- taxcalc/tests/test_utils.py +78 -46
- taxcalc/utils.py +49 -42
- taxcalc/validation/taxsim35/taxsim_emulation.json +1 -5
- {taxcalc-4.3.5.dist-info → taxcalc-4.4.1.dist-info}/METADATA +23 -11
- {taxcalc-4.3.5.dist-info → taxcalc-4.4.1.dist-info}/RECORD +47 -47
- {taxcalc-4.3.5.dist-info → taxcalc-4.4.1.dist-info}/WHEEL +1 -1
- {taxcalc-4.3.5.dist-info → taxcalc-4.4.1.dist-info}/LICENSE +0 -0
- {taxcalc-4.3.5.dist-info → taxcalc-4.4.1.dist-info}/entry_points.txt +0 -0
- {taxcalc-4.3.5.dist-info → taxcalc-4.4.1.dist-info}/top_level.txt +0 -0
taxcalc/tests/test_decorators.py
CHANGED
@@ -1,18 +1,28 @@
|
|
1
|
+
"""
|
2
|
+
Test decorators.
|
3
|
+
"""
|
1
4
|
# CODING-STYLE CHECKS:
|
2
5
|
# pycodestyle test_decorators.py
|
6
|
+
# pylint --disable=locally-disabled test_decorators.py
|
3
7
|
|
4
8
|
import os
|
5
|
-
import sys
|
6
|
-
import pytest
|
7
9
|
import importlib
|
8
10
|
import numpy as np
|
9
11
|
from pandas import DataFrame
|
10
12
|
from pandas.testing import assert_frame_equal
|
13
|
+
import pytest
|
11
14
|
import taxcalc
|
12
|
-
from taxcalc.decorators import
|
15
|
+
from taxcalc.decorators import (
|
16
|
+
iterate_jit,
|
17
|
+
apply_jit,
|
18
|
+
create_apply_function_string,
|
19
|
+
create_toplevel_function_string,
|
20
|
+
make_apply_function,
|
21
|
+
)
|
13
22
|
|
14
23
|
|
15
24
|
def test_create_apply_function_string():
|
25
|
+
"""Test docstring"""
|
16
26
|
ans = create_apply_function_string(['a', 'b', 'c'], ['d', 'e'], [])
|
17
27
|
exp = ("def ap_func(x_0,x_1,x_2,x_3,x_4):\n"
|
18
28
|
" for i in range(len(x_0)):\n"
|
@@ -22,6 +32,7 @@ def test_create_apply_function_string():
|
|
22
32
|
|
23
33
|
|
24
34
|
def test_create_apply_function_string_with_params():
|
35
|
+
"""Test docstring"""
|
25
36
|
ans = create_apply_function_string(['a', 'b', 'c'], ['d', 'e'], ['d'])
|
26
37
|
exp = ("def ap_func(x_0,x_1,x_2,x_3,x_4):\n"
|
27
38
|
" for i in range(len(x_0)):\n"
|
@@ -31,6 +42,7 @@ def test_create_apply_function_string_with_params():
|
|
31
42
|
|
32
43
|
|
33
44
|
def test_create_toplevel_function_string_mult_outputs():
|
45
|
+
"""Test docstring"""
|
34
46
|
ans = create_toplevel_function_string(['a', 'b'], ['d', 'e'],
|
35
47
|
['pm', 'pm', 'pf', 'pm'])
|
36
48
|
exp = ''
|
@@ -55,6 +67,7 @@ def test_create_toplevel_function_string_mult_outputs():
|
|
55
67
|
|
56
68
|
|
57
69
|
def test_create_toplevel_function_string():
|
70
|
+
"""Test docstring"""
|
58
71
|
ans = create_toplevel_function_string(['a'], ['d', 'e'],
|
59
72
|
['pm', 'pf', 'pm'])
|
60
73
|
exp = ''
|
@@ -78,12 +91,14 @@ def test_create_toplevel_function_string():
|
|
78
91
|
|
79
92
|
|
80
93
|
def some_calc(x, y, z):
|
94
|
+
"""Function docstring"""
|
81
95
|
a = x + y
|
82
96
|
b = x + y + z
|
83
97
|
return (a, b)
|
84
98
|
|
85
99
|
|
86
100
|
def test_make_apply_function():
|
101
|
+
"""Test docstring"""
|
87
102
|
ans_do_jit = make_apply_function(some_calc, ['a', 'b'], ['x', 'y', 'z'],
|
88
103
|
[], do_jit=True, no_python=True)
|
89
104
|
assert ans_do_jit
|
@@ -93,33 +108,45 @@ def test_make_apply_function():
|
|
93
108
|
|
94
109
|
|
95
110
|
@apply_jit(["a", "b"], ["x", "y", "z"], nopython=True)
|
96
|
-
def
|
111
|
+
def magic_calc(x, y, z):
|
112
|
+
"""Function docstring"""
|
97
113
|
a = x + y
|
98
114
|
b = x + y + z
|
99
115
|
return (a, b)
|
100
116
|
|
101
117
|
|
102
|
-
def
|
118
|
+
def magic(pm, pf):
|
119
|
+
"""Function docstring"""
|
103
120
|
# Adjustments
|
104
|
-
|
121
|
+
# pylint: disable=no-value-for-parameter
|
122
|
+
outputs = pf.a, pf.b = magic_calc(pm, pf)
|
123
|
+
# pylint: enable=no-value-for-parameter
|
105
124
|
header = ['a', 'b']
|
106
125
|
return DataFrame(data=np.column_stack(outputs), columns=header)
|
107
126
|
|
108
127
|
|
109
128
|
@iterate_jit(nopython=True)
|
110
|
-
def
|
129
|
+
def magic_calc2(x, y, z):
|
130
|
+
"""Function docstring"""
|
111
131
|
a = x + y
|
112
132
|
b = x + y + z
|
113
133
|
return (a, b)
|
114
134
|
|
115
135
|
|
116
|
-
class Foo
|
117
|
-
|
136
|
+
class Foo: # pylint: disable=too-many-instance-attributes
|
137
|
+
"""Foo class"""
|
138
|
+
|
139
|
+
def faux_method1(self):
|
140
|
+
""" Foo method"""
|
141
|
+
|
142
|
+
def faux_method2(self):
|
143
|
+
""" Foo method"""
|
118
144
|
|
119
145
|
|
120
146
|
@iterate_jit(nopython=True)
|
121
|
-
def faux_function(
|
122
|
-
|
147
|
+
def faux_function(mars):
|
148
|
+
"""Function docstring"""
|
149
|
+
if mars == 1:
|
123
150
|
var = 2
|
124
151
|
else:
|
125
152
|
var = 1
|
@@ -128,17 +155,21 @@ def faux_function(MARS):
|
|
128
155
|
|
129
156
|
@iterate_jit(nopython=True)
|
130
157
|
def ret_everything(a, b, c, d, e, f):
|
131
|
-
|
158
|
+
"""Function docstring"""
|
159
|
+
# pylint: disable=too-many-arguments,too-many-positional-arguments
|
132
160
|
c = a + b
|
133
161
|
d = a + b
|
134
162
|
e = a + b
|
135
163
|
f = a + b
|
136
|
-
|
137
164
|
return (c, d, e,
|
138
165
|
f)
|
139
166
|
|
140
167
|
|
168
|
+
# pylint: disable=attribute-defined-outside-init
|
169
|
+
|
170
|
+
|
141
171
|
def test_magic_apply_jit():
|
172
|
+
"""Test docstring"""
|
142
173
|
pm = Foo()
|
143
174
|
pf = Foo()
|
144
175
|
pm.a = np.ones((5,))
|
@@ -146,12 +177,13 @@ def test_magic_apply_jit():
|
|
146
177
|
pf.x = np.ones((5,))
|
147
178
|
pf.y = np.ones((5,))
|
148
179
|
pf.z = np.ones((5,))
|
149
|
-
xx =
|
180
|
+
xx = magic(pm, pf)
|
150
181
|
exp = DataFrame(data=[[2.0, 3.0]] * 5, columns=["a", "b"])
|
151
182
|
assert_frame_equal(xx, exp)
|
152
183
|
|
153
184
|
|
154
185
|
def test_magic_apply_jit_swap():
|
186
|
+
"""Test docstring"""
|
155
187
|
pm = Foo()
|
156
188
|
pf = Foo()
|
157
189
|
pm.a = np.ones((5,))
|
@@ -159,12 +191,16 @@ def test_magic_apply_jit_swap():
|
|
159
191
|
pf.x = np.ones((5,))
|
160
192
|
pf.y = np.ones((5,))
|
161
193
|
pf.z = np.ones((5,))
|
162
|
-
xx =
|
194
|
+
xx = magic(pf, pm) # pylint: disable=arguments-out-of-order
|
163
195
|
exp = DataFrame(data=[[2.0, 3.0]] * 5, columns=["a", "b"])
|
164
196
|
assert_frame_equal(xx, exp)
|
165
197
|
|
166
198
|
|
199
|
+
# pylint: disable=no-value-for-parameter
|
200
|
+
|
201
|
+
|
167
202
|
def test_magic_iterate_jit():
|
203
|
+
"""Test docstring"""
|
168
204
|
pm = Foo()
|
169
205
|
pf = Foo()
|
170
206
|
pm.a = np.ones((1, 5))
|
@@ -172,22 +208,24 @@ def test_magic_iterate_jit():
|
|
172
208
|
pf.x = np.ones((5,))
|
173
209
|
pf.y = np.ones((5,))
|
174
210
|
pf.z = np.ones((5,))
|
175
|
-
xx =
|
211
|
+
xx = magic_calc2(pm, pf)
|
176
212
|
exp = DataFrame(data=[[2.0, 3.0]] * 5, columns=["a", "b"])
|
177
213
|
assert_frame_equal(xx, exp)
|
178
214
|
|
179
215
|
|
180
216
|
def test_faux_function_iterate_jit():
|
217
|
+
"""Test docstring"""
|
181
218
|
pm = Foo()
|
182
219
|
pf = Foo()
|
183
|
-
pf.
|
220
|
+
pf.mars = np.ones((5,))
|
184
221
|
pf.var = np.ones((5,))
|
185
|
-
ans = faux_function(pm, pf)
|
222
|
+
ans = faux_function(pm, pf) # pylint: disable=too-many-function-args
|
186
223
|
exp = DataFrame(data=[2.0] * 5, columns=['var'])
|
187
224
|
assert_frame_equal(ans, exp)
|
188
225
|
|
189
226
|
|
190
227
|
def test_ret_everything_iterate_jit():
|
228
|
+
"""Test docstring"""
|
191
229
|
pm = Foo()
|
192
230
|
pf = Foo()
|
193
231
|
pf.a = np.ones((5,))
|
@@ -203,13 +241,15 @@ def test_ret_everything_iterate_jit():
|
|
203
241
|
|
204
242
|
|
205
243
|
@iterate_jit(nopython=True)
|
206
|
-
def
|
244
|
+
def magic_calc3(x, y, z):
|
245
|
+
"""Function docstring"""
|
207
246
|
a = x + y
|
208
247
|
b = a + z
|
209
248
|
return (a, b)
|
210
249
|
|
211
250
|
|
212
251
|
def test_function_takes_kwarg():
|
252
|
+
"""Test docstring"""
|
213
253
|
pm = Foo()
|
214
254
|
pf = Foo()
|
215
255
|
pm.a = np.ones((1, 5))
|
@@ -217,20 +257,22 @@ def test_function_takes_kwarg():
|
|
217
257
|
pf.x = np.ones((5,))
|
218
258
|
pf.y = np.ones((5,))
|
219
259
|
pf.z = np.ones((5,))
|
220
|
-
ans =
|
260
|
+
ans = magic_calc3(pm, pf)
|
221
261
|
exp = DataFrame(data=[[2.0, 3.0]] * 5,
|
222
262
|
columns=["a", "b"])
|
223
263
|
assert_frame_equal(ans, exp)
|
224
264
|
|
225
265
|
|
226
266
|
@iterate_jit(nopython=True)
|
227
|
-
def
|
267
|
+
def magic_calc4(x, y, z):
|
268
|
+
"""Function docstring"""
|
228
269
|
a = x + y
|
229
270
|
b = a + z
|
230
271
|
return (a, b)
|
231
272
|
|
232
273
|
|
233
274
|
def test_function_no_parameters_listed():
|
275
|
+
"""Test docstring"""
|
234
276
|
pm = Foo()
|
235
277
|
pf = Foo()
|
236
278
|
pm.a = np.ones((1, 5))
|
@@ -238,20 +280,22 @@ def test_function_no_parameters_listed():
|
|
238
280
|
pf.x = np.ones((5,))
|
239
281
|
pf.y = np.ones((5,))
|
240
282
|
pf.z = np.ones((5,))
|
241
|
-
ans =
|
283
|
+
ans = magic_calc4(pm, pf)
|
242
284
|
exp = DataFrame(data=[[2.0, 3.0]] * 5,
|
243
285
|
columns=["a", "b"])
|
244
286
|
assert_frame_equal(ans, exp)
|
245
287
|
|
246
288
|
|
247
289
|
@iterate_jit(parameters=['w'], nopython=True)
|
248
|
-
def
|
290
|
+
def magic_calc5(w, x, y, z):
|
291
|
+
"""Function docstring"""
|
249
292
|
a = x + y
|
250
293
|
b = w[0] + x + y + z
|
251
294
|
return (a, b)
|
252
295
|
|
253
296
|
|
254
297
|
def test_function_parameters_optional():
|
298
|
+
"""Test docstring"""
|
255
299
|
pm = Foo()
|
256
300
|
pf = Foo()
|
257
301
|
pm.a = np.ones((1, 5))
|
@@ -260,30 +304,37 @@ def test_function_parameters_optional():
|
|
260
304
|
pf.x = np.ones((5,))
|
261
305
|
pf.y = np.ones((5,))
|
262
306
|
pf.z = np.ones((5,))
|
263
|
-
ans =
|
307
|
+
ans = magic_calc5(pm, pf)
|
264
308
|
exp = DataFrame(data=[[2.0, 4.0]] * 5,
|
265
309
|
columns=["a", "b"])
|
266
310
|
assert_frame_equal(ans, exp)
|
267
311
|
|
268
312
|
|
313
|
+
# pylint: enable=no-value-for-parameter
|
314
|
+
|
315
|
+
|
269
316
|
def unjittable_function1(w, x, y, z):
|
270
|
-
|
271
|
-
|
317
|
+
"""Function docstring"""
|
318
|
+
a = x + y # pylint: disable=unused-variable
|
319
|
+
b = w[0] + x + y + z # pylint: disable=unused-variable
|
272
320
|
|
273
321
|
|
274
322
|
def unjittable_function2(w, x, y, z):
|
323
|
+
"""Function docstring"""
|
275
324
|
a = x + y
|
276
325
|
b = w[0] + x + y + z
|
277
|
-
return (a, b, c)
|
326
|
+
return (a, b, c) # pylint: disable=undefined-variable
|
278
327
|
|
279
328
|
|
280
329
|
def test_iterate_jit_raises_on_no_return():
|
330
|
+
"""Test docstring"""
|
281
331
|
with pytest.raises(ValueError):
|
282
332
|
ij = iterate_jit(parameters=['w'], nopython=True)
|
283
333
|
ij(unjittable_function1)
|
284
334
|
|
285
335
|
|
286
336
|
def test_iterate_jit_raises_on_unknown_return_argument():
|
337
|
+
"""Test docstring"""
|
287
338
|
ij = iterate_jit(parameters=['w'], nopython=True)
|
288
339
|
uf2 = ij(unjittable_function2)
|
289
340
|
pm = Foo()
|
@@ -295,10 +346,11 @@ def test_iterate_jit_raises_on_unknown_return_argument():
|
|
295
346
|
pf.y = np.ones((5,))
|
296
347
|
pf.z = np.ones((5,))
|
297
348
|
with pytest.raises(AttributeError):
|
298
|
-
ans = uf2(pm, pf)
|
349
|
+
ans = uf2(pm, pf) # pylint: disable=unused-variable
|
299
350
|
|
300
351
|
|
301
|
-
def
|
352
|
+
def magic_calc6(w, x, y, z):
|
353
|
+
"""Function docstring"""
|
302
354
|
a = x + y
|
303
355
|
b = w[0] + x + y + z
|
304
356
|
return (a, b)
|
@@ -313,8 +365,8 @@ def test_force_no_jit():
|
|
313
365
|
os.environ['NOTAXCALCJIT'] = 'NOJIT'
|
314
366
|
# reload the decorators module
|
315
367
|
importlib.reload(taxcalc.decorators)
|
316
|
-
# verify
|
317
|
-
|
368
|
+
# verify magic_calc6 function works as expected
|
369
|
+
magic_calc6_ = iterate_jit(parameters=['w'], nopython=True)(magic_calc6)
|
318
370
|
pm = Foo()
|
319
371
|
pf = Foo()
|
320
372
|
pm.a = np.ones((1, 5))
|
@@ -323,7 +375,7 @@ def test_force_no_jit():
|
|
323
375
|
pf.x = np.ones((5,))
|
324
376
|
pf.y = np.ones((5,))
|
325
377
|
pf.z = np.ones((5,))
|
326
|
-
ans =
|
378
|
+
ans = magic_calc6_(pm, pf)
|
327
379
|
exp = DataFrame(data=[[2.0, 4.0]] * 5,
|
328
380
|
columns=["a", "b"])
|
329
381
|
assert_frame_equal(ans, exp)
|
taxcalc/tests/test_growdiff.py
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
+
"""
|
2
|
+
Test GrowDiff class and its methods.
|
3
|
+
"""
|
1
4
|
# CODING-STYLE CHECKS:
|
2
5
|
# pycodestyle test_growdiff.py
|
6
|
+
# pylint --disable=locally-disabled test_growdiff.py
|
3
7
|
|
4
8
|
import os
|
5
9
|
import json
|
6
10
|
import numpy as np
|
7
|
-
import pytest
|
8
11
|
from taxcalc import GrowDiff, GrowFactors, Policy
|
9
12
|
|
10
13
|
|
11
|
-
def
|
14
|
+
def test_start_year_consistency():
|
15
|
+
"""Test docstring"""
|
12
16
|
assert GrowDiff.JSON_START_YEAR == Policy.JSON_START_YEAR
|
13
|
-
assert GrowDiff.DEFAULT_NUM_YEARS == Policy.DEFAULT_NUM_YEARS
|
14
17
|
|
15
18
|
|
16
19
|
def test_update_and_apply_growdiff():
|
20
|
+
"""Test docstring"""
|
17
21
|
gdiff = GrowDiff()
|
18
22
|
# update GrowDiff instance
|
19
23
|
diffs = {
|
@@ -21,28 +25,29 @@ def test_update_and_apply_growdiff():
|
|
21
25
|
2016: 0.02}
|
22
26
|
}
|
23
27
|
gdiff.update_growdiff(diffs)
|
24
|
-
|
25
|
-
extra_years =
|
26
|
-
|
27
|
-
|
28
|
+
exp_wage_diffs = [0.00, 0.01, 0.01, 0.02, 0.02]
|
29
|
+
extra_years = gdiff.num_years - len(exp_wage_diffs)
|
30
|
+
exp_wage_diffs.extend([0.02] * extra_years)
|
31
|
+
act_wage_diffs = gdiff._AWAGE # pylint: disable=protected-access
|
32
|
+
assert np.allclose(act_wage_diffs, exp_wage_diffs, atol=0.0, rtol=0.0)
|
28
33
|
# apply growdiff to GrowFactors instance
|
29
34
|
gf = GrowFactors()
|
30
|
-
syr =
|
31
|
-
|
32
|
-
lyr = syr + nyrs - 1
|
35
|
+
syr = gdiff.start_year
|
36
|
+
lyr = gdiff.end_year
|
33
37
|
pir_pre = gf.price_inflation_rates(syr, lyr)
|
34
38
|
wgr_pre = gf.wage_growth_rates(syr, lyr)
|
35
39
|
gfactors = GrowFactors()
|
36
40
|
gdiff.apply_to(gfactors)
|
37
41
|
pir_pst = gfactors.price_inflation_rates(syr, lyr)
|
38
42
|
wgr_pst = gfactors.wage_growth_rates(syr, lyr)
|
39
|
-
expected_wgr_pst = [wgr_pre[i] +
|
40
|
-
for i in range(0,
|
43
|
+
expected_wgr_pst = [wgr_pre[i] + exp_wage_diffs[i]
|
44
|
+
for i in range(0, gdiff.num_years)]
|
41
45
|
assert np.allclose(pir_pre, pir_pst, atol=0.0, rtol=0.0)
|
42
46
|
assert np.allclose(wgr_pst, expected_wgr_pst, atol=1.0e-9, rtol=0.0)
|
43
47
|
|
44
48
|
|
45
49
|
def test_has_any_response():
|
50
|
+
"""Test docstring"""
|
46
51
|
start_year = GrowDiff.JSON_START_YEAR
|
47
52
|
gdiff = GrowDiff()
|
48
53
|
assert gdiff.current_year == start_year
|
@@ -58,7 +63,7 @@ def test_description_punctuation(tests_path):
|
|
58
63
|
"""
|
59
64
|
# read JSON file into a dictionary
|
60
65
|
path = os.path.join(tests_path, '..', 'growdiff.json')
|
61
|
-
with open(path, 'r') as jsonfile:
|
66
|
+
with open(path, 'r', encoding='utf-8') as jsonfile:
|
62
67
|
dct = json.load(jsonfile)
|
63
68
|
all_desc_ok = True
|
64
69
|
for param in dct.keys():
|
@@ -78,7 +83,7 @@ def test_boolean_value_infomation(tests_path):
|
|
78
83
|
"""
|
79
84
|
# read growdiff.json file into a dictionary
|
80
85
|
path = os.path.join(tests_path, '..', 'growdiff.json')
|
81
|
-
with open(path, 'r') as gddfile:
|
86
|
+
with open(path, 'r', encoding='utf-8') as gddfile:
|
82
87
|
gdd = json.load(gddfile)
|
83
88
|
for param in gdd.keys():
|
84
89
|
if param == "schema":
|
@@ -88,11 +93,7 @@ def test_boolean_value_infomation(tests_path):
|
|
88
93
|
val = val[0]
|
89
94
|
if isinstance(val, list):
|
90
95
|
val = val[0]
|
91
|
-
|
92
|
-
if valstr == 'True' or valstr == 'False':
|
93
|
-
val_is_boolean = True
|
94
|
-
else:
|
95
|
-
val_is_boolean = False
|
96
|
+
val_is_boolean = str(val) in ('True', 'False')
|
96
97
|
type_is_boolean = gdd[param]['type'] == 'bool'
|
97
98
|
if val_is_boolean and not type_is_boolean:
|
98
99
|
print('param,value_type,val,val_is_boolean=',
|
@@ -8,8 +8,9 @@ Tests of Tax-Calculator GrowFactors class.
|
|
8
8
|
import os
|
9
9
|
import tempfile
|
10
10
|
import pytest
|
11
|
-
|
12
|
-
from taxcalc import
|
11
|
+
from taxcalc.growfactors import GrowFactors
|
12
|
+
from taxcalc.policy import Policy
|
13
|
+
from taxcalc.records import Records
|
13
14
|
|
14
15
|
|
15
16
|
@pytest.fixture(scope='module', name='bad_gf_file')
|
@@ -17,11 +18,10 @@ def fixture_bad_gf_file():
|
|
17
18
|
"""
|
18
19
|
Fixture for invalid growfactors file.
|
19
20
|
"""
|
20
|
-
txt = (
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
tfile.close()
|
21
|
+
txt = ('YEAR,AWAGE,ACPIU,ABADNAME,ASOCSEC\n'
|
22
|
+
'2015,1.000,1.000,1.000000,1.00000\n')
|
23
|
+
with tempfile.NamedTemporaryFile(mode='a', delete=False) as tfile:
|
24
|
+
tfile.write(txt)
|
25
25
|
yield tfile
|
26
26
|
os.remove(tfile.name)
|
27
27
|
|
@@ -31,7 +31,7 @@ def test_improper_usage(bad_gf_file):
|
|
31
31
|
Tests of improper usage of GrowFactors object.
|
32
32
|
"""
|
33
33
|
with pytest.raises(ValueError):
|
34
|
-
gfo = GrowFactors(
|
34
|
+
gfo = GrowFactors({})
|
35
35
|
with pytest.raises(ValueError):
|
36
36
|
gfo = GrowFactors('non_existent_file.csv')
|
37
37
|
with pytest.raises(ValueError):
|