mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
remove the uneeded save_data test utility function
This commit is contained in:
parent
b9b97ba652
commit
35a10d48cc
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, save_data, contains_word
|
||||
from utilities import execution_path, contains_word
|
||||
|
||||
import os, mapnik
|
||||
|
||||
@ -40,8 +40,6 @@ def test_multi_tile_policy():
|
||||
im = mapnik.Image(_map.width, _map.height)
|
||||
mapnik.render(_map, im)
|
||||
|
||||
save_data('test_multi_tile_policy.png', im.tostring('png'))
|
||||
|
||||
# test green chunk
|
||||
eq_(im.view(0,64,1,1).tostring(), '\x00\xff\x00\xff')
|
||||
eq_(im.view(127,64,1,1).tostring(), '\x00\xff\x00\xff')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, save_data, contains_word
|
||||
from utilities import execution_path, contains_word
|
||||
|
||||
import os, mapnik
|
||||
|
||||
@ -51,8 +51,6 @@ def test_dataraster_coloring():
|
||||
|
||||
im = mapnik.Image(_map.width,_map.height)
|
||||
mapnik.render(_map, im)
|
||||
# save a png somewhere so we can see it
|
||||
save_data('test_dataraster_coloring.png', im.tostring('png'))
|
||||
imdata = im.tostring()
|
||||
# we have some values in the [20,30) interval so check that they're colored
|
||||
assert contains_word('\xff\xff\x00\xff', imdata)
|
||||
@ -135,8 +133,6 @@ def test_raster_with_alpha_blends_correctly_with_background():
|
||||
mim = mapnik.Image(WIDTH, HEIGHT)
|
||||
|
||||
mapnik.render(map, mim)
|
||||
save_data('test_raster_with_alpha_blends_correctly_with_background.png',
|
||||
mim.tostring('png'))
|
||||
imdata = mim.tostring()
|
||||
# All white is expected
|
||||
assert contains_word('\xff\xff\xff\xff', imdata)
|
||||
@ -166,8 +162,6 @@ def test_raster_warping():
|
||||
|
||||
im = mapnik.Image(_map.width,_map.height)
|
||||
mapnik.render(_map, im)
|
||||
# save a png somewhere so we can see it
|
||||
save_data('test_raster_warping.png', im.tostring('png'))
|
||||
imdata = im.tostring()
|
||||
assert contains_word('\xff\xff\x00\xff', imdata)
|
||||
|
||||
@ -195,9 +189,6 @@ def test_raster_warping_does_not_overclip_source():
|
||||
|
||||
im = mapnik.Image(_map.width,_map.height)
|
||||
mapnik.render(_map, im)
|
||||
# save a png somewhere so we can see it
|
||||
save_data('test_raster_warping_does_not_overclip_source.png',
|
||||
im.tostring('png'))
|
||||
assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff'
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -15,20 +15,6 @@ class TodoPlugin(ErrorClassPlugin):
|
||||
|
||||
todo = ErrorClass(Todo, label='TODO', isfailure=False)
|
||||
|
||||
def save_data(filename, data, key='MAPNIK_TEST_DATA_DIR'):
|
||||
"""Saves bytestring 'data' into os.environ[key]/filename if
|
||||
key in os.environ"""
|
||||
if key in os.environ:
|
||||
dir = os.environ[key]
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
fname = os.path.join(dir, filename)
|
||||
f = open(fname, 'w')
|
||||
try:
|
||||
f.write(data)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
def contains_word(word, bytestring_):
|
||||
"""
|
||||
Checks that a bytestring contains a given word. len(bytestring) should be
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user