Skip to content

Commit

Permalink
Merge pull request #130 from tilezen/zerebubuth/long-zooms
Browse files Browse the repository at this point in the history
Support long zooms
  • Loading branch information
zerebubuth authored Dec 8, 2016
2 parents 8422703 + 57846f8 commit 7720431
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,16 @@ def test_zoom_out_of_range(self):
zoom = 7
with self.assertRaises(AssertionError):
get_queue(zoom)

def test_zoom_is_long(self):
# the zoom (or row/col) in a Coordinate can be a long simply because
# the coordinate it was derived from in unmarshall_coord_int was a
# long.
from tilequeue.command import make_get_queue_name_for_zoom
zoom_queue_map_cfg = {'0-20': 'q1'}
queue_names = ['q1']
get_queue = make_get_queue_name_for_zoom(
zoom_queue_map_cfg, queue_names)
zoom = long(7)
queue_name = get_queue(zoom)
self.assertEqual(queue_name, 'q1')
2 changes: 1 addition & 1 deletion tilequeue/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self, zoom_queue_table):
self.zoom_queue_table = zoom_queue_table

def __call__(self, zoom):
assert isinstance(zoom, int)
assert isinstance(zoom, (int, long))
assert 0 <= zoom <= 20
result = self.zoom_queue_table.get(zoom)
assert result is not None, 'No queue name found for zoom: %d' % zoom
Expand Down

0 comments on commit 7720431

Please sign in to comment.