Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artemp committed May 19, 2016
1 parent cd14aad commit 1521215
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
10 changes: 5 additions & 5 deletions test/python_tests/geojson_plugin_test.py
Expand Up @@ -32,7 +32,7 @@ def test_geojson_properties():
type='geojson',
file='../data/json/escaped.geojson')
f = ds.features_at_point(ds.envelope().center()).features[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)
desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)

Expand All @@ -49,7 +49,7 @@ def test_geojson_properties():
type='geojson',
file='../data/json/escaped.geojson')
f = ds.all_features()[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)

desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
Expand All @@ -69,7 +69,7 @@ def test_large_geojson_properties():
file='../data/json/escaped.geojson',
cache_features=False)
f = ds.features_at_point(ds.envelope().center()).features[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)
desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)

Expand All @@ -86,7 +86,7 @@ def test_large_geojson_properties():
type='geojson',
file='../data/json/escaped.geojson')
f = ds.all_features()[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)

desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_that_nonexistant_query_field_throws(**kwargs):
ds = mapnik.Datasource(
type='geojson',
file='../data/json/escaped.geojson')
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)
# TODO - this sorting is messed up
#eq_(ds.fields(),['name', 'int', 'double', 'description', 'boolean', 'NOM_FR'])
#eq_(ds.field_types(),['str', 'int', 'float', 'str', 'bool', 'str'])
Expand Down
26 changes: 14 additions & 12 deletions test/python_tests/topojson_plugin_test.py
Expand Up @@ -19,11 +19,11 @@ def setup():
if 'topojson' in mapnik.DatasourceCache.plugin_names():

def test_topojson_init():
# topojson tests/data/json/escaped.geojson -o tests/data/json/escaped.topojson --properties
# topojson tests/data/json/escaped.geojson -o tests/data/topojson/escaped.topojson --properties
# topojson version 1.4.2
ds = mapnik.Datasource(
type='topojson',
file='../data/json/escaped.topojson')
file='../data/topojson/escaped.topojson')
e = ds.envelope()
assert_almost_equal(e.minx, -81.705583, places=7)
assert_almost_equal(e.miny, 41.480573, places=6)
Expand All @@ -33,9 +33,9 @@ def test_topojson_init():
def test_topojson_properties():
ds = mapnik.Datasource(
type='topojson',
file='../data/json/escaped.topojson')
file='../data/topojson/escaped.topojson')
f = ds.features_at_point(ds.envelope().center()).features[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)
desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)

Expand All @@ -50,9 +50,9 @@ def test_topojson_properties():

ds = mapnik.Datasource(
type='topojson',
file='../data/json/escaped.topojson')
file='../data/topojson/escaped.topojson')
f = ds.all_features()[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)

desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
Expand All @@ -70,10 +70,10 @@ def test_geojson_from_in_memory_string():
ds = mapnik.Datasource(
type='topojson',
inline=open(
'../data/json/escaped.topojson',
'../data/topojson/escaped.topojson',
'r').read())
f = ds.all_features()[0]
eq_(len(ds.fields()), 7)
eq_(len(ds.fields()), 11)

desc = ds.describe()
eq_(desc['geometry_type'], mapnik.DataGeometryType.Point)
Expand All @@ -91,13 +91,15 @@ def test_geojson_from_in_memory_string():
def test_that_nonexistant_query_field_throws(**kwargs):
ds = mapnik.Datasource(
type='topojson',
file='../data/json/escaped.topojson')
eq_(len(ds.fields()), 7)
file='../data/topojson/escaped.topojson')
eq_(len(ds.fields()), 11)
# TODO - this sorting is messed up
eq_(ds.fields(), ['name', 'int', 'description',
'spaces', 'double', 'boolean', 'NOM_FR'])
'spaces', 'double', 'boolean', 'NOM_FR',
'object', 'array', 'empty_array', 'empty_object'])
eq_(ds.field_types(), ['str', 'int',
'str', 'str', 'float', 'bool', 'str'])
'str', 'str', 'float', 'bool', 'str',
'str', 'str', 'str', 'str'])
# TODO - should topojson plugin throw like others?
# query = mapnik.Query(ds.envelope())
# for fld in ds.fields():
Expand Down

0 comments on commit 1521215

Please sign in to comment.