+ update tests to respect new real formatting policies

This commit is contained in:
artemp 2012-12-18 12:13:42 +00:00
parent e82e5e2fb3
commit ae69ee9a24
5 changed files with 20 additions and 16 deletions

View file

@ -20,9 +20,9 @@ map_ = '''<Map>
<![CDATA[
([region] >= 0)
([region] >= 0)
and
and
([region] <= 50)
]]>
@ -49,7 +49,7 @@ map_ = '''<Map>
</Style>
</Map>'''
def test_filter_init():
def test_filter_init():
m = mapnik.Map(1,1)
mapnik.load_map_from_string(m,map_)
filters = []
@ -74,7 +74,7 @@ def test_filter_init():
0)
and
([region]
<=
<=
50)
'''))
@ -174,13 +174,17 @@ def test_float_precision():
context = mapnik.Context()
context.push('num')
f = mapnik.Feature(context,0)
f["num"] = 1.0000
eq_(f["num"],1.0000)
expr = mapnik.Expression("[num] = 1.0000")
f["num1"] = 1.0000
f["num2"] = 1.0001
eq_(f["num1"],1.0000)
eq_(f["num2"],1.0001)
expr = mapnik.Expression("[num1] = 1.0000")
eq_(expr.evaluate(f),True)
expr = mapnik.Expression("[num].match('.*0$')")
expr = mapnik.Expression("[num1].match('1')")
eq_(expr.evaluate(f),True)
expr = mapnik.Expression("[num].match('.*0$')")
expr = mapnik.Expression("[num2] = 1.0001")
eq_(expr.evaluate(f),True)
expr = mapnik.Expression("[num2].match('1.0001')")
eq_(expr.evaluate(f),True)
def test_string_matching_on_precision():

View file

@ -14,7 +14,7 @@ def setup():
wkts = [
[1,"POINT(30 10)"],
[1,"POINT(30.0 10.0)"],
[1,"POINT(30 10)"],
[1,"POINT(30.1 10.1)"],
[1,"LINESTRING(30 10,10 30,40 40)"],
[1,"POLYGON((30 10,10 20,20 40,40 40,30 10))"],
@ -61,7 +61,7 @@ wkbs = [
]
geojson = [
[1,'{"type":"Point","coordinates":[30.0,10.0]}'],
[1,'{"type":"Point","coordinates":[30,10]}'],
[1,'{"type":"Point","coordinates":[30.0,10.0]}'],
[1,'{"type":"Point","coordinates":[30.1,10.1]}'],
[1,'{"type":"LineString","coordinates":[[30.0,10.0],[10.0,30.0],[40.0,40.0]]}'],

View file

@ -182,11 +182,11 @@ def test_shield_symbolizer_modify():
def check_transform(expr, expect_str=None):
s.transform = expr
eq_(s.transform, expr if expect_str is None else expect_str)
check_transform("matrix(1 2 3 4 5 6)", "matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)")
check_transform("matrix(1 2 3 4 5 6)", "matrix(1, 2, 3, 4, 5, 6)")
check_transform("matrix(1, 2, 3, 4, 5, 6 +7)", "matrix(1, 2, 3, 4, 5, (6+7))")
check_transform("rotate([a])")
check_transform("rotate([a] -2)", "rotate(([a]-2))")
check_transform("rotate([a] -2 -3)", "rotate([a], -2.0, -3.0)")
check_transform("rotate([a] -2 -3)", "rotate([a], -2, -3)")
check_transform("rotate([a] -2 -3 -4)", "rotate(((([a]-2)-3)-4))")
check_transform("rotate([a] -2, 3, 4)", "rotate(([a]-2), 3, 4)")
check_transform("translate([tx]) rotate([a])")
@ -231,7 +231,7 @@ def test_markers_symbolizer():
eq_(p.transform,'')
eq_(p.clip,True)
eq_(p.comp_op,mapnik.CompositeOp.src_over)
p.width = mapnik.Expression('12')
p.height = mapnik.Expression('12')

View file

@ -133,7 +133,7 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
eq_(feat['name'],'test point')
geoms = feat.geometries()
eq_(len(geoms),1)
eq_(geoms.to_wkt(),'Point(-122.0 48.0)')
eq_(geoms.to_wkt(),'Point(-122 48)')
# ensure it matches data read with just sqlite
cur = conn.cursor()

View file

@ -358,7 +358,7 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
#eq_(feat.id(),1)
eq_(feat['alias'],'test')
eq_(len(feat.geometries()),1)
eq_(feat.geometries()[0].to_wkt(),'Point(0.0 0.0)')
eq_(feat.geometries()[0].to_wkt(),'Point(0 0)')
if __name__ == "__main__":
setup()