From 2bed3d1acf868d01d521a2e92e71d094a19d6fe8 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 16 Aug 2012 18:18:00 -0700 Subject: [PATCH] add test for reading csv from string --- tests/python_tests/csv_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/python_tests/csv_test.py b/tests/python_tests/csv_test.py index 414df8818..9638da754 100644 --- a/tests/python_tests/csv_test.py +++ b/tests/python_tests/csv_test.py @@ -352,6 +352,18 @@ if 'csv' in mapnik.DatasourceCache.instance().plugin_names(): ds = get_csv_ds('line_wkt.csv') eq_(ds.describe()['geometry_type'],mapnik.DataGeometryType.LineString) + def test_creation_of_csv_from_in_memory_string(**kwargs): + csv_string = ''' + wkt,Name + "POINT (120.15 48.47)","Winthrop, WA" + ''' # csv plugin will test lines <= 10 chars for being fully blank + ds = mapnik.Datasource(**{"type":"csv","inline":csv_string}) + eq_(ds.describe()['geometry_type'],mapnik.DataGeometryType.Point) + fs = ds.featureset() + feat = fs.next() + eq_(feat['Name'],u"Winthrop, WA") + + if __name__ == "__main__": setup() [eval(run)(visual=True) for run in dir() if 'test_' in run]