tests for 64bit id handling in osm.input

This commit is contained in:
Dane Springmeyer 2013-01-02 17:39:12 -08:00
parent 0516c6e120
commit 1641519adc
2 changed files with 27 additions and 1 deletions

14
tests/data/osm/64bit.osm Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="mapnik">
<node id="4294968186" version="3" timestamp="2007-11-24T19:38:32Z" uid="4946" user="user_4946" changeset="609026" lat="17.1415874" lon="-61.7960248"/>
<node id="9223372036854775807" version="7" timestamp="2012-05-11T01:45:18Z" uid="24440" user="jaakkoh" changeset="11564167" lat="17.1416038" lon="-61.793673">
<tag k="highway" v="mini_roundabout"/>
<tag k="junction" v="roundabout"/>
<tag k="note" v="mini_roundabout can&apos;t have a center island, see wiki for more info"/>
<tag k="bigint" v="9223372036854775807"/>
</node>
<way id="1000" version="14" timestamp="2010-04-07T06:08:57Z" uid="28756" user="Nescum" changeset="4351472">
<nd ref="4294968186"/>
<nd ref="9223372036854775807"/>
</way>
</osm>

View file

@ -13,7 +13,7 @@ def setup():
if 'osm' in mapnik.DatasourceCache.plugin_names():
# Shapefile initialization
# osm initialization
def test_osm_init():
ds = mapnik.Osm(file='../data/osm/nodes.osm')
@ -40,6 +40,18 @@ if 'osm' in mapnik.DatasourceCache.plugin_names():
query.add_property_name('bogus')
fs = ds.features(query)
def test_that_64bit_int_fields_work():
ds = mapnik.Osm(file='../data/osm/64bit.osm')
eq_(len(ds.fields()),5)
eq_(ds.fields(),['bigint', 'highway', 'junction', 'name', 'note'])
eq_(ds.field_types(),['str', 'str', 'str', 'str', 'str'])
fs = ds.featureset()
feat = fs.next()
eq_(feat.id(),4294968186)
eq_(feat['bigint'],'')
feat = fs.next()
eq_(feat['bigint'],'9223372036854775807')
if __name__ == "__main__":
setup()