cleanup TODO usage in python tests

This commit is contained in:
Dane Springmeyer 2013-06-03 15:02:43 -07:00
parent 28bdb881f0
commit 78dc1a4199
10 changed files with 48 additions and 66 deletions

View file

@ -1,17 +1,17 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" minimum-version="0.7.2" paths-from-xml="false">
<Map background-color="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" minimum-version="0.7.2">
<Style name="test 1">
<Rule>
<Filter>[foo]='bar'</Filter>
<PointSymbolizer file="../data/images/dummy.png"/>
<PointSymbolizer file="../images/dummy.png"/>
</Rule>
<Rule>
<ElseFilter/>
<PointSymbolizer file="../data/images/dummy.png"/>
<PointSymbolizer file="../images/dummy.png"/>
</Rule>
<Rule>
<AlsoFilter/>
<PointSymbolizer file="../data/images/dummy.png"/>
<PointSymbolizer file="../images/dummy.png"/>
</Rule>
</Style>
</Map>

View file

@ -1,43 +1,43 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" minimum-version="0.7.2" paths-from-xml="false">
<Map background-color="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" minimum-version="0.7.2">
<Style name="test 1">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="true"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="true"/>
</Rule>
</Style>
<Style name="test 2">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="yes"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="yes"/>
</Rule>
</Style>
<Style name="test 3">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="on"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="on"/>
</Rule>
</Style>
<Style name="test 4">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="1"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="1"/>
</Rule>
</Style>
<Style name="test 5">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="false"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="false"/>
</Rule>
</Style>
<Style name="test 6">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="no"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="no"/>
</Rule>
</Style>
<Style name="test 7">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="off"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="off"/>
</Rule>
</Style>
<Style name="test 8">
<Rule>
<PointSymbolizer file="../data/images/dummy.png" allow-overlap="0"/>
<PointSymbolizer file="../images/dummy.png" allow-overlap="0"/>
</Rule>
</Style>
</Map>

View file

@ -254,8 +254,8 @@ def test_background_image_with_alpha_and_background_color_against_composited_con
im1.demultiply()
# compare image rendered (compositing in `agg_renderer<T>::setup`)
# vs image composited via python bindings
raise Todo("looks like we need to investigate PNG color rounding when saving")
eq_(get_unique_colors(im),get_unique_colors(im1))
#raise Todo("looks like we need to investigate PNG color rounding when saving")
#eq_(get_unique_colors(im),get_unique_colors(im1))
if __name__ == "__main__":
setup()

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all,Todo
from utilities import execution_path, run_all
import os, sys, glob, mapnik
import itertools
@ -46,7 +46,8 @@ def test_shapefile_polygon_feature_query_id():
compare_shape_between_mapnik_and_ogr('../data/shp/world_merc.shp',query)
def test_feature_hit_count():
raise Todo("need to optimize multigeom bbox handling in shapeindex: https://github.com/mapnik/mapnik/issues/783")
pass
#raise Todo("need to optimize multigeom bbox handling in shapeindex: https://github.com/mapnik/mapnik/issues/783")
# results in different results between shp and ogr!
#bbox = (-14284551.8434, 2074195.1992, -7474929.8687, 8140237.7628)
bbox = (1113194.91,4512803.085,2226389.82,6739192.905)

View file

@ -3,7 +3,6 @@
from nose.tools import *
import os,sys
from utilities import execution_path, run_all
from utilities import Todo
import mapnik
from binascii import unhexlify
@ -195,16 +194,15 @@ def test_geometry_index_error2():
f.geometries()[3]
def test_wkt_rounding():
raise Todo("fixme or remove test")
# currently fails because we use output precision of 6 - should we make configurable? https://github.com/mapnik/mapnik/issues/1009
# if precision is set to 15 still fails due to very subtle rounding issues
wkt = "POLYGON((7.904185417583761 54.180426336712856,7.89918053477129 54.178168035931542,7.897715691021261 54.182318426556606,7.893565300396205 54.183111883587891,7.89039147227129 54.187567449994106,7.885874870708761 54.190680242962827,7.879893425396261 54.193915106244049,7.894541862896233 54.194647528119134,7.900645378521233 54.190680242962827,7.904185417583761 54.180426336712856))"
wkt = "POLYGON((7.904185 54.180426,7.89918 54.178168,7.897715 54.182318,7.893565 54.183111,7.890391 54.187567,7.885874 54.19068,7.879893 54.193915,7.894541 54.194647,7.900645 54.19068,7.904185 54.180426))"
compare_wkt_from_wkt(wkt,1)
def test_wkt_collection_flattening():
raise Todo("fixme or remove test")
wkt = 'GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)),POLYGON((40 40,20 45,45 30,40 40)),POLYGON((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)),LINESTRING(2 3,3 4))'
# currently fails as the MULTIPOLYGON inside will be returned as multiple polygons - not a huge deal - should we worry?
wkt = "GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)),MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20))),LINESTRING(2 3,3 4))"
#wkt = "GEOMETRYCOLLECTION(POLYGON((1 1,2 1,2 2,1 2,1 1)),MULTIPOLYGON(((40 40,20 45,45 30,40 40)),((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20))),LINESTRING(2 3,3 4))"
compare_wkt_from_wkt(wkt,4)
# skip since this data is not checked into tests

View file

@ -4,7 +4,6 @@
import os
from nose.tools import *
from utilities import execution_path, run_all
from utilities import Todo
import tempfile
import mapnik

View file

@ -2,7 +2,7 @@
from nose.tools import *
from utilities import execution_path, run_all, Todo
from utilities import execution_path, run_all
import os, sys, glob, mapnik

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from nose.tools import *
from utilities import execution_path, run_all, Todo
from utilities import execution_path, run_all
import os, mapnik
def setup():

View file

@ -4,7 +4,6 @@
import os
from nose.tools import *
from utilities import execution_path, run_all
from utilities import Todo
import tempfile
import mapnik, pickle

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import Todo
from utilities import execution_path, run_all
import tempfile
@ -12,47 +11,33 @@ def setup():
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test():
# TODO: Write a better test
# 1. Construct map in memory
# 2. Save map as XML
# 3. Load map to a second object
# 4. Compare both map objects
map = mapnik.Map(256, 256)
def compare_map(xml):
m = mapnik.Map(256, 256)
absolute_base = os.path.abspath(os.path.dirname(xml))
mapnik.load_map(m, xml, False, absolute_base)
(handle, test_map) = tempfile.mkstemp(suffix='.xml', prefix='mapnik-temp-map1-')
os.close(handle)
(handle, test_map2) = tempfile.mkstemp(suffix='.xml', prefix='mapnik-temp-map2-')
os.close(handle)
if os.path.exists(test_map):
os.remove(test_map)
mapnik.save_map(m, test_map)
new_map = mapnik.Map(256, 256)
mapnik.load_map(new_map, test_map,False,absolute_base)
open(test_map2,'w').write(mapnik.save_map_to_string(new_map))
diff = ' diff %s %s' % (os.path.abspath(test_map),os.path.abspath(test_map2))
try:
eq_(open(test_map).read(),open(test_map2).read())
except AssertionError, e:
raise AssertionError('serialized map "%s" not the same after being reloaded, \ncompare with command:\n\n$%s' % (xml,diff))
raise Todo("map comparison is currently broken due to lacking relative paths support (#324,#340")
def compare_map(in_map):
mapnik.load_map(map, in_map)
(handle, test_map) = tempfile.mkstemp(suffix='.xml', prefix='mapnik-temp-map1-')
os.close(handle)
(handle, test_map2) = tempfile.mkstemp(suffix='.xml', prefix='mapnik-temp-map2-')
os.close(handle)
if os.path.exists(test_map):
os.remove(test_map)
mapnik.save_map(map, test_map)
new_map = mapnik.Map(256, 256)
mapnik.load_map(new_map, test_map)
open(test_map2,'w').write(mapnik.save_map_to_string(new_map))
diff = ' diff %s %s' % (os.path.abspath(test_map),os.path.abspath(test_map2))
try:
eq_(open(test_map).read(),open(test_map2).read())
except AssertionError, e:
raise AssertionError('serialized map "%s" not the same after being reloaded, \ncompare with command:\n\n$%s' % (in_map,diff))
if os.path.exists(test_map):
os.remove(test_map)
else:
# Fail, the map wasn't written
return False
if os.path.exists(test_map):
os.remove(test_map)
else:
# Fail, the map wasn't written
return False
def test_compare_map():
for m in glob.glob("../data/good_maps/*.xml"):
compare_map(m)