Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broaden scope of test_taxcalcio.py to increase code coverage #1234

Merged
merged 1 commit into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions taxcalc/taxcalcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,51 +263,6 @@ def calculate(self, writing_output_file=False,
print(ceeu_results) # pylint: disable=superfluous-parens
return output_lines

"""
@staticmethod
def construct_output_line(output_dict):

Construct line of OUTPUT from a filing unit output_dict.

Parameters
----------
output_dict: dictionary
calculated output values indexed from 1 to len(output_dict).

Returns
-------
output_line: string

outline = ''
for vnum in range(1, len(output_dict) + 1):
fnum = min(vnum, TaxCalcIO.OVAR_NUM)
outline += TaxCalcIO.OVAR_FMT[fnum].format(output_dict[vnum])
outline += '\n'
return outline



@staticmethod
def write_output_file(output, output_filename):

Write all output to file with output_filename.

Parameters
----------
output: dictionary of OUTPUT variables for each INPUT tax filing unit

output_filename: string

Returns
-------
nothing: void

with open(output_filename, 'w') as output_file:
for idx in range(0, len(output)):
outline = TaxCalcIO.construct_output_line(output[idx])
output_file.write(outline)
"""

def standard_output(self):
"""
Extract standard output and return as pandas DataFrame.
Expand Down
17 changes: 13 additions & 4 deletions taxcalc/tests/test_taxcalcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,26 @@ def test_3(rawinputfile, reformfile1, assumpfile1):
aging_input_data=False,
exact_calculations=False)
outfilepath = tcio.output_filepath()
# try file writing
# try output file writing
try:
output = tcio.calculate(writing_output_file=True)
output = tcio.calculate(writing_output_file=True, output_ceeu=True)
except: # pylint: disable=bare-except
if os.path.isfile(outfilepath):
try:
os.remove(outfilepath)
except OSError:
pass # sometimes we can't remove a generated temporary file
assert 'TaxCalcIO.calculate()_ok' == 'no'
# if the try was successful, try to remove the output file
assert 'TaxCalcIO.calculate()_ok(1)' == 'no'
try:
output = tcio.calculate(writing_output_file=True, output_dump=True)
except: # pylint: disable=bare-except
if os.path.isfile(outfilepath):
try:
os.remove(outfilepath)
except OSError:
pass # sometimes we can't remove a generated temporary file
assert 'TaxCalcIO.calculate()_ok(2)' == 'no'
# if tries were successful, try to remove the output file
if os.path.isfile(outfilepath):
try:
os.remove(outfilepath)
Expand Down