Fix geojson_source_to_csv crash on non-uniform feature properties - #108
Merged
Conversation
…rce_to_csv output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
geojson_source_to_csv()picked its output CSV columns from the first feature's properties only, then crashed withValueError: dict contains fields not in fieldnamesas soon as a later feature had a property key the first feature didn't have.DictWriter's defaultrestval=''.Fixes #106
Test plan
test_geojson_source_to_csv_non_uniform_properties, reproducing the crash with two features that have different property keysdocker run --rm -v "$(pwd)":/usr/local/src/batch-machine -w /usr/local/src/batch-machine batch-machine-test:latest python3 -m unittest openaddr.tests.conform -v— all 65 tests pass