1
- #!/usr/bin/env python
2
-
3
- import os
4
-
5
- from nose .tools import eq_
6
-
7
1
import mapnik
8
2
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
-
18
3
def test_multi_tile_policy ():
19
4
srs = 'epsg:4326'
20
5
lyr = mapnik .Layer ('raster' )
21
6
if 'raster' in mapnik .DatasourceCache .plugin_names ():
22
7
lyr .datasource = mapnik .Raster (
23
- file = '.. /data/raster_tiles/${x}/${y}.tif' ,
8
+ file = './test /data/raster_tiles/${x}/${y}.tif' ,
24
9
lox = - 180 ,
25
10
loy = - 90 ,
26
11
hix = 180 ,
@@ -46,29 +31,25 @@ def test_multi_tile_policy():
46
31
mapnik .render (_map , im )
47
32
48
33
# 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 '
53
38
54
39
# 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 '
59
44
60
45
# 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 '
65
50
66
51
# 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