1- #!/usr/bin/env python
2-
3- import os
4-
5- from nose .tools import eq_
6-
71import mapnik
82
9- from .utilities import execution_path , run_all
10-
11-
12- def setup ():
13- # All of the paths used are relative, if we run the tests
14- # from another directory we need to chdir()
15- os .chdir (execution_path ('.' ))
16-
17-
183def test_multi_tile_policy ():
194 srs = 'epsg:4326'
205 lyr = mapnik .Layer ('raster' )
216 if 'raster' in mapnik .DatasourceCache .plugin_names ():
227 lyr .datasource = mapnik .Raster (
23- file = '.. /data/raster_tiles/${x}/${y}.tif' ,
8+ file = './test /data/raster_tiles/${x}/${y}.tif' ,
249 lox = - 180 ,
2510 loy = - 90 ,
2611 hix = 180 ,
@@ -46,29 +31,25 @@ def test_multi_tile_policy():
4631 mapnik .render (_map , im )
4732
4833 # test green chunk
49- eq_ ( im .view (0 , 64 , 1 , 1 ).tostring (), b'\x00 \xff \x00 \xff ' )
50- eq_ ( im .view (127 , 64 , 1 , 1 ).tostring (), b'\x00 \xff \x00 \xff ' )
51- eq_ ( im .view (0 , 127 , 1 , 1 ).tostring (), b'\x00 \xff \x00 \xff ' )
52- eq_ ( im .view (127 , 127 , 1 , 1 ).tostring (), b'\x00 \xff \x00 \xff ' )
34+ assert im .view (0 , 64 , 1 , 1 ).tostring () == b'\x00 \xff \x00 \xff '
35+ assert im .view (127 , 64 , 1 , 1 ).tostring () == b'\x00 \xff \x00 \xff '
36+ assert im .view (0 , 127 , 1 , 1 ).tostring () == b'\x00 \xff \x00 \xff '
37+ assert im .view (127 , 127 , 1 , 1 ).tostring () == b'\x00 \xff \x00 \xff '
5338
5439 # test blue chunk
55- eq_ ( im .view (128 , 64 , 1 , 1 ).tostring (), b'\x00 \x00 \xff \xff ' )
56- eq_ ( im .view (255 , 64 , 1 , 1 ).tostring (), b'\x00 \x00 \xff \xff ' )
57- eq_ ( im .view (128 , 127 , 1 , 1 ).tostring (), b'\x00 \x00 \xff \xff ' )
58- eq_ ( im .view (255 , 127 , 1 , 1 ).tostring (), b'\x00 \x00 \xff \xff ' )
40+ assert im .view (128 , 64 , 1 , 1 ).tostring () == b'\x00 \x00 \xff \xff '
41+ assert im .view (255 , 64 , 1 , 1 ).tostring () == b'\x00 \x00 \xff \xff '
42+ assert im .view (128 , 127 , 1 , 1 ).tostring () == b'\x00 \x00 \xff \xff '
43+ assert im .view (255 , 127 , 1 , 1 ).tostring () == b'\x00 \x00 \xff \xff '
5944
6045 # test red chunk
61- eq_ ( im .view (0 , 128 , 1 , 1 ).tostring (), b'\xff \x00 \x00 \xff ' )
62- eq_ ( im .view (127 , 128 , 1 , 1 ).tostring (), b'\xff \x00 \x00 \xff ' )
63- eq_ ( im .view (0 , 191 , 1 , 1 ).tostring (), b'\xff \x00 \x00 \xff ' )
64- eq_ ( im .view (127 , 191 , 1 , 1 ).tostring (), b'\xff \x00 \x00 \xff ' )
46+ assert im .view (0 , 128 , 1 , 1 ).tostring () == b'\xff \x00 \x00 \xff '
47+ assert im .view (127 , 128 , 1 , 1 ).tostring () == b'\xff \x00 \x00 \xff '
48+ assert im .view (0 , 191 , 1 , 1 ).tostring () == b'\xff \x00 \x00 \xff '
49+ assert im .view (127 , 191 , 1 , 1 ).tostring () == b'\xff \x00 \x00 \xff '
6550
6651 # test magenta chunk
67- eq_ (im .view (128 , 128 , 1 , 1 ).tostring (), b'\xff \x00 \xff \xff ' )
68- eq_ (im .view (255 , 128 , 1 , 1 ).tostring (), b'\xff \x00 \xff \xff ' )
69- eq_ (im .view (128 , 191 , 1 , 1 ).tostring (), b'\xff \x00 \xff \xff ' )
70- eq_ (im .view (255 , 191 , 1 , 1 ).tostring (), b'\xff \x00 \xff \xff ' )
71-
72- if __name__ == "__main__" :
73- setup ()
74- exit (run_all (eval (x ) for x in dir () if x .startswith ("test_" )))
52+ assert im .view (128 , 128 , 1 , 1 ).tostring () == b'\xff \x00 \xff \xff '
53+ assert im .view (255 , 128 , 1 , 1 ).tostring () == b'\xff \x00 \xff \xff '
54+ assert im .view (128 , 191 , 1 , 1 ).tostring () == b'\xff \x00 \xff \xff '
55+ assert im .view (255 , 191 , 1 , 1 ).tostring () == b'\xff \x00 \xff \xff '
0 commit comments