Skip to content

Commit

Permalink
adds: tests for csv
Browse files Browse the repository at this point in the history
  • Loading branch information
msramalho committed Sep 27, 2022
1 parent 6536681 commit 484d3cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions geoclustering/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def visitor(self, cluster_id, cluster):
self.state,
fieldnames=["cluster_id"] + list(cluster[0].keys()),
quoting=csv.QUOTE_NONNUMERIC,
lineterminator="\n",
)
self.writer.writeheader()

Expand Down
1 change: 1 addition & 0 deletions tests/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ def test_encoders():
assert res["string"] == read_fixture_content("snapshots/result.txt")
assert res["json"] == read_fixture_content("snapshots/result.json")
assert res["geojson"] == read_fixture_content("snapshots/result.geojson")
assert res["csv"] == read_fixture_content("snapshots/result.csv")
5 changes: 5 additions & 0 deletions tests/fixtures/snapshots/result.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"cluster_id","id","name","lat","lon"
0,1,"Alice",52.523955,13.442362
0,2,"Bob",52.526659,13.448097
1,3,"Carol",52.525626,13.419246
1,4,"Dan",52.52443559865125,13.41261723049818

0 comments on commit 484d3cb

Please sign in to comment.