pyflakes driven python file cleanup

This commit is contained in:
Dane Springmeyer 2015-02-02 10:31:16 -08:00
parent 0f3bffde24
commit 7d78115886
63 changed files with 131 additions and 178 deletions

View file

@ -19,7 +19,7 @@
#
#
import os, re, sys, glob
import glob
from subprocess import Popen, PIPE

View file

@ -41,7 +41,6 @@ Several things happen when you do:
import itertools
import os
import sys
import warnings
try:
import json

View file

@ -17,7 +17,7 @@ see the documentation of mapnik.printing.PDFPrinter() for options
"""
from __future__ import absolute_import
from . import render, Map, Box2d, Layer, Feature, Projection, ProjTransform, Coord, Style, Rule, Geometry2d
from . import render, Map, Box2d, Layer, Feature, Projection, Coord, Style, Geometry2d
import math
import os
import tempfile

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_
from utilities import run_all
import mapnik
import json

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from nose.tools import *
from utilities import execution_path, run_all
from nose.tools import eq_,assert_true,assert_almost_equal,assert_false
from utilities import run_all
import mapnik
def test_coord_init():

View file

@ -1,7 +1,5 @@
import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
def setup():

View file

@ -3,7 +3,7 @@
import os
import shutil
import mapnik
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
def setup():

View file

@ -1,8 +1,8 @@
#encoding: utf8
from nose.tools import *
import os,sys
from utilities import execution_path, run_all, Todo
from nose.tools import eq_
import os
from utilities import execution_path, run_all
from utilities import get_unique_colors, pixel2channels, side_by_side_image
import mapnik

View file

@ -2,8 +2,7 @@
# -*- coding: utf-8 -*-
import glob
import sys
from nose.tools import *
from nose.tools import eq_,raises
from utilities import execution_path
import os, mapnik
@ -33,25 +32,26 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
broken.append("../data/csv/fails/does_not_exist.csv")
for csv in broken:
throws = False
if visual:
try:
ds = mapnik.Datasource(type='csv',file=csv,strict=True)
print '\x1b[33mfailed\x1b[0m',csv
mapnik.Datasource(type='csv',file=csv,strict=True)
print '\x1b[33mfailed: should have thrown\x1b[0m',csv
except Exception:
print '\x1b[1;32m✓ \x1b[0m', csv
def test_good_files(visual=False):
good_files = glob.glob("../data/csv/*.*")
good_files.extend(glob.glob("../data/csv/warns/*.*"))
ignorable = os.path.join('..','data','csv','long_lat.vrt')
good_files.remove(ignorable)
for csv in good_files:
if visual:
try:
ds = mapnik.Datasource(type='csv',file=csv)
mapnik.Datasource(type='csv',file=csv)
print '\x1b[1;32m✓ \x1b[0m', csv
except Exception:
print '\x1b[33mfailed\x1b[0m',csv
except Exception, e:
print '\x1b[33mfailed: should not have thrown\x1b[0m',csv,str(e)
def test_lon_lat_detection(**kwargs):
ds = get_csv_ds('lon_lat.csv')
@ -68,7 +68,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
attr = {'lon': 0, 'lat': 0}
eq_(feat.attributes,attr)
def test_lon_lat_detection(**kwargs):
def test_lng_lat_detection(**kwargs):
ds = get_csv_ds('lng_lat.csv')
eq_(len(ds.fields()),2)
eq_(ds.fields(),['lng','lat'])
@ -357,9 +357,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
query.add_property_name(fld)
# also add an invalid one, triggering throw
query.add_property_name('bogus')
fs = ds.features(query)
desc = ds.describe()
eq_(desc['geometry_type'],mapnik.DataGeometryType.Point)
ds.features(query)
def test_that_leading_zeros_mean_strings(**kwargs):
ds = get_csv_ds('leading_zeros.csv')
@ -471,7 +469,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
@raises(RuntimeError)
def test_that_fewer_headers_than_rows_throws(**kwargs):
# this has invalid header # so throw
ds = get_csv_ds('more_column_values_than_headers.csv')
get_csv_ds('more_column_values_than_headers.csv')
def test_that_feature_id_only_incremented_for_valid_rows(**kwargs):
ds = mapnik.Datasource(type='csv',

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik
from itertools import groupby
def setup():
# All of the paths used are relative, if we run the tests
@ -119,8 +120,6 @@ def test_ogr_layer_by_sql():
eq_(num_feats, 1)
def test_hit_grid():
import os
from itertools import groupby
def rle_encode(l):
""" encode a list of strings with run-length compression """

View file

@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import os
from nose.tools import *
from utilities import execution_path, run_all
import mapnik

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, sys, glob, mapnik
import os, mapnik
import itertools
def setup():

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools,sys
import unittest
from nose.tools import *
from utilities import execution_path, run_all
from nose.tools import eq_,raises
from utilities import run_all
import mapnik
from binascii import unhexlify
@ -77,7 +76,7 @@ def test_feature_expression_evaluation_missing_attr():
expr = mapnik.Expression("[fielddoesnotexist]='a'")
eq_(f.has_key('fielddoesnotexist'),False)
try:
evaluated = expr.evaluate(f)
expr.evaluate(f)
except Exception, e:
eq_("Key does not exist" in str(e),True)
num_attributes = len(f)
@ -112,7 +111,7 @@ def test_feature_from_geojson():
}
}
"""
feat = mapnik.Feature.from_geojson(inline_string,ctx)
mapnik.Feature.from_geojson(inline_string,ctx)
if __name__ == "__main__":
exit(run_all(eval(x) for x in dir() if x.startswith("test_")))

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,raises
from utilities import run_all
import mapnik
@ -443,7 +443,7 @@ def test_division_by_zero():
@raises(RuntimeError)
def test_invalid_syntax1():
expr = mapnik.Expression('abs()')
mapnik.Expression('abs()')
if __name__ == "__main__":

View file

@ -1,16 +0,0 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all
import mapnik
# Tests that exercise fonts.
# Trac Ticket #31
# Todo: Add logic to use this TextSymbolizer in a rendering
#@raises(UserWarning)
#def test_invalid_font():
# ts = mapnik.TextSymbolizer('Name', 'Invalid Font Name', int(8), mapnik.Color('black'))
if __name__ == "__main__":
exit(run_all(eval(x) for x in dir() if x.startswith("test_")))

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,assert_almost_equal
from utilities import execution_path, run_all
import os, mapnik

View file

@ -1,7 +1,7 @@
#encoding: utf8
from nose.tools import *
import os,sys
from nose.tools import eq_,raises
import os
from utilities import execution_path, run_all
import mapnik
from binascii import unhexlify
@ -136,18 +136,18 @@ def test_wkb_parsing():
def test_geojson_parsing():
path = mapnik.Path()
count = 0
for json in geojson:
count += json[0]
path.add_geojson(json[1])
for j in geojson:
count += j[0]
path.add_geojson(j[1])
eq_(count,len(path))
def test_geojson_parsing_reversed():
path = mapnik.Path()
path2 = mapnik.Path()
count = 0
for idx,json in enumerate(geojson_reversed):
count += json[0]
path.add_geojson(json[1])
for idx,j in enumerate(geojson_reversed):
count += j[0]
path.add_geojson(j[1])
path2.add_geojson(geojson[idx][1])
eq_(path.to_geojson(),path2.to_geojson())
eq_(count,len(path))
@ -166,7 +166,7 @@ def test_geojson_point_positions():
path.add_geojson('{"type":"Point","coordinates":[30,10,50,50,50,50]}')
eq_(path.to_geojson(),input_json)
def test_geojson_point_positions():
def test_geojson_point_positions2():
input_json = '{"type":"LineString","coordinates":[[30,10],[10,30],[40,40]]}'
path = mapnik.Path()
@ -333,9 +333,9 @@ def test_creating_feature_from_geojson():
eq_(feat['name'],u'value')
def test_handling_geojson_null_geoms():
for json in geojson_nulls:
for j in geojson_nulls:
ctx = mapnik.Context()
out_json = mapnik.Feature.from_geojson(json,ctx).to_geojson()
out_json = mapnik.Feature.from_geojson(j,ctx).to_geojson()
expected = '{"type":"Feature","id":1,"geometry":null,"properties":{}}'
eq_(out_json,expected)
# ensure it round trips

View file

@ -1,6 +1,6 @@
import mapnik
from nose.tools import *
from utilities import execution_path, run_all
from nose.tools import eq_
from utilities import run_all
def test_grayscale_conversion():
im = mapnik.Image(2,2)

View file

@ -113,7 +113,6 @@ def do_encoding():
min_ = str(s[0])[:6]
avg = str(s[1])[:6]
elapsed = str(s[2])[:6]
percent_reduction = s[4]
name = s[3]
size = s[4]
print 'min: %sms | avg: %sms | total: %sms | len: %s <-- %s' % (min_,avg,elapsed,size,name)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
from utilities import side_by_side_image
import os, mapnik

View file

@ -1,10 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from nose.tools import eq_,raises
from utilities import execution_path, run_all
def setup():
@ -24,6 +22,9 @@ def test_image_premultiply():
def test_negative_image_dimensions():
# TODO - this may have regressed in https://github.com/mapnik/mapnik/commit/4f3521ac24b61fc8ae8fd344a16dc3a5fdf15af7
im = mapnik.Image(-40,40)
# should not get here
eq_(im.width(),0)
eq_(im.height(),0)
def test_jpeg_round_trip():
filepath = '/tmp/mapnik-jpeg-io.jpeg'

View file

@ -1,10 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
def setup():

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
import os
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import mapnik

View file

@ -1,9 +1,8 @@
#encoding: utf8
from nose.tools import *
import os,sys
from nose.tools import eq_
import mapnik
from utilities import execution_path, run_all
from utilities import run_all
try:
import json
except ImportError:

View file

@ -2,7 +2,7 @@
import os
import mapnik
from utilities import execution_path, run_all
from nose.tools import *
from nose.tools import eq_
def setup():
# All of the paths used are relative, if we run the tests

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
import os
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import mapnik

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from utilities import execution_path, run_all
from nose.tools import eq_
from utilities import run_all
import mapnik
# Map initialization

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, sys, glob, mapnik
import os, glob, mapnik
default_logging_severity = mapnik.logger.get_severity()

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_,raises,assert_almost_equal
from utilities import execution_path, run_all
import os, mapnik

View file

@ -1,11 +1,8 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all
from subprocess import Popen, PIPE, STDOUT
import os
import os, sys, glob, mapnik
from nose.tools import eq_
from utilities import run_all
from subprocess import Popen, PIPE
def test_mapnik_config_no_args():
process = Popen('mapnik-config', shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all
from nose.tools import eq_
from utilities import run_all
import mapnik
def test_logger_init():

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from utilities import execution_path, run_all
import os, mapnik
from glob import glob
@ -41,7 +40,7 @@ def test_opening_data():
kwargs = {'type': 'ogr','file': filepath}
kwargs['layer_by_index'] = 0
try:
ds = mapnik.Datasource(**kwargs)
mapnik.Datasource(**kwargs)
except Exception, e:
print 'could not open, %s: %s' % (kwargs,e)
else:
@ -50,7 +49,7 @@ def test_opening_data():
if plugin is 'ogr':
kwargs['layer_by_index'] = 0
try:
ds = mapnik.Datasource(**kwargs)
mapnik.Datasource(**kwargs)
except Exception, e:
print 'could not open, %s: %s' % (kwargs,e)
#else:

View file

@ -2,7 +2,7 @@
import os
import mapnik
from utilities import execution_path, run_all
from nose.tools import *
from nose.tools import eq_
def setup():
# All of the paths used are relative, if we run the tests

View file

@ -1,7 +1,7 @@
#encoding: utf8
import mapnik
from utilities import execution_path, run_all
from nose.tools import *
from utilities import run_all
from nose.tools import eq_
def test_add_feature():
md = mapnik.MemoryDatasource()

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all, contains_word
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik
def setup():

View file

@ -1,10 +1,8 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, sys, glob, mapnik
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,assert_almost_equal,raises
from utilities import execution_path, run_all
import os, mapnik
@ -52,7 +52,7 @@ if 'ogr' in mapnik.DatasourceCache.plugin_names():
query.add_property_name(fld)
# also add an invalid one, triggering throw
query.add_property_name('bogus')
fs = ds.features(query)
ds.features(query)
# disabled because OGR prints an annoying error: ERROR 1: Invalid Point object. Missing 'coordinates' member.
#def test_handling_of_null_features():

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik
@ -32,7 +32,7 @@ if 'osm' in mapnik.DatasourceCache.plugin_names():
query.add_property_name(fld)
# also add an invalid one, triggering throw
query.add_property_name('bogus')
fs = ds.features(query)
ds.features(query)
def test_that_64bit_int_fields_work():
ds = mapnik.Osm(file='../data/osm/64bit.osm')

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik

View file

@ -3,7 +3,7 @@
import os
import sys
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import mapnik

View file

@ -1,17 +1,14 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_,assert_almost_equal
import atexit
import cProfile, pstats, io
import time
from utilities import execution_path, run_all
from subprocess import Popen, PIPE
import os, mapnik
from Queue import Queue
import threading
import sys
import re
from binascii import hexlify, unhexlify
from binascii import hexlify
MAPNIK_TEST_DBNAME = 'mapnik-tmp-pgraster-test-db'
@ -49,7 +46,7 @@ def psql_can_connect():
try:
call('psql %s -c "select postgis_version()"' % POSTGIS_TEMPLATE_DBNAME)
return True
except RuntimeError, e:
except RuntimeError:
print 'Notice: skipping pgraster tests (connection)'
return False
@ -67,7 +64,7 @@ def raster2pgsql_on_path():
try:
call('raster2pgsql')
return True
except RuntimeError, e:
except RuntimeError:
print 'Notice: skipping pgraster tests (raster2pgsql)'
return False
@ -80,7 +77,7 @@ def createdb_and_dropdb_on_path():
call('createdb --help')
call('dropdb --help')
return True
except RuntimeError, e:
except RuntimeError:
print 'Notice: skipping pgraster tests (createdb/dropdb)'
return False

View file

@ -2,9 +2,8 @@
# -*- coding: utf-8 -*-
import os
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import tempfile
import mapnik, pickle

View file

@ -1,10 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
def setup():

View file

@ -2,7 +2,7 @@
import os
import mapnik
from nose.tools import *
from nose.tools import assert_raises
from utilities import execution_path, run_all
datadir = '../data/pngsuite'

View file

@ -1,12 +1,10 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_,raises
import atexit
import time
from utilities import execution_path, run_all
from subprocess import Popen, PIPE
import os, mapnik
from Queue import Queue
import threading
@ -41,7 +39,7 @@ def psql_can_connect():
try:
call('psql %s -c "select postgis_version()"' % POSTGIS_TEMPLATE_DBNAME)
return True
except RuntimeError, e:
except RuntimeError:
print 'Notice: skipping postgis tests (connection)'
return False
@ -53,7 +51,7 @@ def shp2pgsql_on_path():
try:
call('shp2pgsql')
return True
except RuntimeError, e:
except RuntimeError:
print 'Notice: skipping postgis tests (shp2pgsql)'
return False
@ -66,7 +64,7 @@ def createdb_and_dropdb_on_path():
call('createdb --help')
call('dropdb --help')
return True
except RuntimeError, e:
except RuntimeError:
print 'Notice: skipping postgis tests (createdb/dropdb)'
return False
@ -340,7 +338,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
query.add_property_name(fld)
# also add an invalid one, triggering throw
query.add_property_name('bogus')
fs = ds.features(query)
ds.features(query)
def test_auto_detection_of_unique_feature_id_32_bit():
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test2',
@ -401,7 +399,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test3',
geometry_field='geom',
autodetect_key_field=True)
fs = ds.featureset()
ds.featureset()
def test_auto_detection_of_unique_feature_id_64_bit():
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='test4',
@ -484,19 +482,19 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
@raises(RuntimeError)
def test_auto_detection_of_invalid_numeric_primary_key():
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select geom, manual_id::numeric from test2) as t''',
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select geom, manual_id::numeric from test2) as t''',
geometry_field='geom',
autodetect_key_field=True)
@raises(RuntimeError)
def test_auto_detection_of_invalid_multiple_keys():
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''test6''',
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''test6''',
geometry_field='geom',
autodetect_key_field=True)
@raises(RuntimeError)
def test_auto_detection_of_invalid_multiple_keys_subquery():
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select first_id,second_id,geom from test6) as t''',
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='''(select first_id,second_id,geom from test6) as t''',
geometry_field='geom',
autodetect_key_field=True)
@ -639,7 +637,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,
table='asdfasdfasdfasdfasdf',
max_size=20)
fs = ds.all_features()
ds.all_features()
except Exception, e:
eq_('in executeQuery' in str(e),True)
@ -800,7 +798,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
# https://github.com/mapnik/mapnik/issues/1816
def test_exception_message_reporting():
try:
ds = mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='doesnotexist')
mapnik.PostGIS(dbname=MAPNIK_TEST_DBNAME,table='doesnotexist')
except Exception, e:
eq_(e.message != 'unidentifiable C++ exception', True)
@ -829,7 +827,7 @@ if 'postgis' in mapnik.DatasourceCache.plugin_names() \
'table':"(select null::bigint as osm_id, GeomFromEWKT('SRID=4326;POINT(0 0)') as geom) as tmp"}
ds = mapnik.Datasource(**opts)
fs = ds.featureset()
feat = fs.next() ## should throw since key_field is null: StopIteration: No more features.
fs.next() ## should throw since key_field is null: StopIteration: No more features.
def test_psql_error_should_not_break_connection_pool():
# Bad request, will trigger an error when returning result

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_,assert_almost_equal
import mapnik
import random
import math
from utilities import run_all, assert_box2d_almost_equal

View file

@ -3,7 +3,7 @@
import os, mapnik
from nose.tools import *
from nose.tools import eq_,assert_almost_equal,raises
from utilities import execution_path, run_all
def setup():

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import os, mapnik

View file

@ -2,7 +2,7 @@
import os
import mapnik
from utilities import execution_path, run_all
from nose.tools import *
from nose.tools import eq_
def setup():
# All of the paths used are relative, if we run the tests

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all, contains_word, get_unique_colors
from nose.tools import eq_
from utilities import execution_path, run_all, get_unique_colors
import os, mapnik
@ -139,7 +139,7 @@ def test_raster_with_alpha_blends_correctly_with_background():
mim = mapnik.Image(WIDTH, HEIGHT)
mapnik.render(map, mim)
imdata = mim.tostring()
mim.tostring()
# All white is expected
eq_(get_unique_colors(mim),['rgba(254,254,254,255)'])

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all, contains_word, get_unique_colors
from nose.tools import eq_,assert_almost_equal
from utilities import execution_path, run_all
import os, mapnik

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,raises
from utilities import execution_path, run_all
import os, mapnik
@ -348,7 +348,7 @@ if mapnik.has_grid_renderer():
# should throw right here since Name will be a property now on the `grid` object
# and it is not found on the second layer
mapnik.render_layer(m,grid,layer=1,fields=['Value'])
utf1 = grid.encode()
grid.encode()
if __name__ == "__main__":
setup()

View file

@ -1,10 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,raises
import tempfile
import os, mapnik
from nose.tools import *
from utilities import execution_path, run_all
def setup():

View file

@ -2,7 +2,7 @@
import os
import mapnik
from utilities import execution_path, run_all
from nose.tools import *
from nose.tools import eq_
def setup():
# All of the paths used are relative, if we run the tests

View file

@ -1,10 +1,10 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
import tempfile
import os, sys, glob, mapnik
import os, glob, mapnik
default_logging_severity = mapnik.logger.get_severity()

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,assert_almost_equal,raises
from utilities import execution_path, run_all
import os, mapnik
@ -49,7 +49,7 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
query.add_property_name(fld)
# also add an invalid one, triggering throw
query.add_property_name('bogus')
fs = ds.features(query)
ds.features(query)
def test_dbf_logical_field_is_boolean():
ds = mapnik.Shapefile(file='../data/shp/long_lat')

View file

@ -1,10 +1,8 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_
from utilities import execution_path, run_all
from Queue import Queue
import threading
import time
import os, mapnik
import sqlite3
@ -19,7 +17,7 @@ TOTAL = 245
def create_ds(test_db,table):
ds = mapnik.SQLite(file=test_db,table=table)
fs = ds.all_features()
ds.all_features()
del ds
if 'sqlite' in mapnik.DatasourceCache.plugin_names():

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python
from nose.tools import *
from nose.tools import eq_, raises
from utilities import execution_path, run_all
import os
import mapnik
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
@ -304,7 +305,7 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
query.add_property_name(fld)
# also add an invalid one, triggering throw
query.add_property_name('bogus')
fs = ds.features(query)
ds.features(query)
def test_intersects_token1():
ds = mapnik.SQLite(file='../data/sqlite/empty.db',

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from nose.tools import *
from utilities import execution_path, run_all
from nose.tools import eq_
from utilities import run_all
import mapnik
def test_style_init():

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from nose.tools import eq_,assert_almost_equal
from utilities import execution_path, run_all
import os, mapnik

View file

@ -4,7 +4,7 @@
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.tools import assert_almost_equal
import os, sys, inspect, traceback
import os, sys, traceback
import mapnik
def execution_path(filename):