diff --git a/pycoast/cw_base.py b/pycoast/cw_base.py index f8291eb..b459962 100644 --- a/pycoast/cw_base.py +++ b/pycoast/cw_base.py @@ -649,8 +649,8 @@ def _iterate_db(self, db_name, tag, resolution, level, zero_pad, db_root_path=No else: format_string += 'L%s.shp' - if type(level) not in (list,): - level = range(1,level+1) + if not isinstance(level, list): + level = range(1, level + 1) for i in level: diff --git a/pycoast/tests/test_pycoast.py b/pycoast/tests/test_pycoast.py index 2bd1e7c..82a6270 100644 --- a/pycoast/tests/test_pycoast.py +++ b/pycoast/tests/test_pycoast.py @@ -100,7 +100,7 @@ def test_europe(self): area_extent = (-3363403.31, -2291879.85, 2630596.69, 2203620.1) area_def = (proj4_string, area_extent) cw = ContourWriterPIL(gshhs_root_dir) - cw.add_coastlines(img, area_def, resolution='l', level=[4]) + cw.add_coastlines(img, area_def, resolution='l', level=4) cw.add_rivers(img, area_def, level=5, outline='blue') cw.add_borders(img, area_def, outline=(255, 0, 0)) @@ -753,7 +753,7 @@ def test_foreground(self): self.assertTrue(fft_metric(euro_data, res), 'Writing of contours failed') - overlays = {'coasts': {'level': 4, 'resolution': 'l'}, + overlays = {'coasts': {'level': [1, 2, 3, 4], 'resolution': 'l'}, 'borders': {'outline': (255, 0, 0), 'resolution': 'c'}, 'rivers': {'outline': 'blue', 'resolution': 'c', 'level': 5}}