-
Notifications
You must be signed in to change notification settings - Fork 5
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
Extraction code validates, but tests fail #113
Extraction code validates, but tests fail #113
Conversation
Note that changes to |
The code snippet is incorrect, and the existing code is right: it should be returning a list of # In most cases there isn't more than one 'Election' in a report, but the
# standard allows more than one, so handle them [as a list of ElectionData] The snippet should be: extractor = BallotDataExtractor()
election_data = extractor.extract(data)
assert isinstance(election_data, list) and len(election_data) == 1 and isinstance(election_data[0], ElectionData)
election_data = election_data[0]
print(election_data.name) Edit: I'll update my example in the forthcoming README and in #112 . |
Also check your function's return type hint |
Yes, full type hint returns are already in my branch for the next round. |
I changed this to Draft while I do additional work. |
Local pytest still fails for me:
Yet all checks pass on GitHub actions. |
Switched from Draft to Ready To Review because:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! The code is much easier to follow now that it's settling down.
I've noted a number of issues for your review, but all of them can be dealt with later if you choose. None of them block merging.
@ion-oset Because I want to merge this PR onto
I then re-tested the code locally and re-generated the ballots just to ensure I didn't break anything. Now it's time to merge! |
Since this PR stayed in draft mode for a few days, the original description is no longer comprehensive, but retained here as an archive of the original post.
I tested the extraction code by updating
ballotmaker validate
, which accepts a JSON EDF and prints the results to the console, thus recapitulating @ion-oset 'sedf-to-ballot-data.py
script.Unfortunately, when I tried to use the code in
data
as a library, I received some unexpected errors.Here's a code snippet from
demo_ballots.py
with the errors listed as comments: