File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ def make_ballots(
1616 Output directory for generated PDF files
1717 Styles file for ballot formatting
1818 """
19- # is the EDF a JSON file?
19+ # is the EDF a file?
2020 if _edf is None :
21- log .debug ("No EDF file provided." )
21+ log .debug ("No EDF file provided to make ballots ." )
2222 return NO_FILE
23- if Path .is_file (_edf ) is False :
24- log .debug (f"{ _edf } is not a file" )
23+ if not _edf .is_file () :
24+ log .debug (f"Can't make ballots, EDF { _edf } is not a file" )
2525 return NO_FILE
2626 # was a valid output directory provided?
2727 # was a styles file provided?
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ def validate_edf(
1616 """
1717 # is the EDF a file?
1818 if _edf is None :
19- log .debug ("No EDF file provided." )
19+ log .debug ("No EDF file provided for validation ." )
2020 return NO_FILE
2121 if not _edf .is_file ():
22- log .debug (f"{ _edf } is not a file" )
22+ log .debug (f"Can't validate, EDF { _edf } is not a file" )
2323 return NO_FILE
2424
2525 ballot_style_count = read_edf (_edf )
Original file line number Diff line number Diff line change 11from pathlib import Path
22
3- from electos .ballotmaker import make_ballots
43from electos .ballotmaker .constants import NO_ERRORS , NO_FILE
4+ from electos .ballotmaker .make_ballots import make_ballots
55
6- not_a_file = Path ("not_a_file .json" )
6+ imaginary_file = Path ("imaginary_file .json" )
77test_dir = Path (__file__ ).parent .resolve ()
88test_file = Path ("june_test_case.json" )
99full_test_path = Path (test_dir , test_file )
1010
1111
1212def test_make_ballots ():
1313 # force a no file error with Path = None
14- assert make_ballots . make_ballots (_edf = None ) == NO_FILE
15- # ensure not_a_file is actually not a file
16- assert Path .is_file (not_a_file ) == False
17- assert make_ballots . make_ballots ( not_a_file ) == NO_FILE
18- assert Path .is_file (full_test_path )
19- assert make_ballots . make_ballots (full_test_path ) == NO_ERRORS
14+ assert make_ballots (_edf = None ) == NO_FILE
15+ # ensure imaginary_file is actually not a file
16+ assert not imaginary_file .is_file ()
17+ assert make_ballots ( imaginary_file ) == NO_FILE
18+ assert full_test_path .is_file ()
19+ assert make_ballots (full_test_path ) == NO_ERRORS
You can’t perform that action at this time.
0 commit comments