mirror of
https://github.com/bellingcat/geoclustering.git
synced 2026-06-07 19:18:30 +03:00
adds: tests for csv
This commit is contained in:
@@ -89,6 +89,7 @@ class CSVEncoder:
|
|||||||
self.state,
|
self.state,
|
||||||
fieldnames=["cluster_id"] + list(cluster[0].keys()),
|
fieldnames=["cluster_id"] + list(cluster[0].keys()),
|
||||||
quoting=csv.QUOTE_NONNUMERIC,
|
quoting=csv.QUOTE_NONNUMERIC,
|
||||||
|
lineterminator="\n",
|
||||||
)
|
)
|
||||||
self.writer.writeheader()
|
self.writer.writeheader()
|
||||||
|
|
||||||
|
|||||||
@@ -27,3 +27,4 @@ def test_encoders():
|
|||||||
assert res["string"] == read_fixture_content("snapshots/result.txt")
|
assert res["string"] == read_fixture_content("snapshots/result.txt")
|
||||||
assert res["json"] == read_fixture_content("snapshots/result.json")
|
assert res["json"] == read_fixture_content("snapshots/result.json")
|
||||||
assert res["geojson"] == read_fixture_content("snapshots/result.geojson")
|
assert res["geojson"] == read_fixture_content("snapshots/result.geojson")
|
||||||
|
assert res["csv"] == read_fixture_content("snapshots/result.csv")
|
||||||
|
|||||||
5
tests/fixtures/snapshots/result.csv
vendored
Normal file
5
tests/fixtures/snapshots/result.csv
vendored
Normal file
@@ -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
|
||||||
|
Reference in New Issue
Block a user