Mercurial > hg > GlobalNeighbors
comparison tests/test_grid.py @ 7:254195d0bac2
partial implementation of autocomplete using jqueryui; easyautocomplete.com may be more what we want
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 25 Jun 2017 09:13:48 -0700 |
parents | 7e27e874655b |
children | d1b99c695511 |
comparison
equal
deleted
inserted
replaced
6:316e1d54ffd4 | 7:254195d0bac2 |
---|---|
52 assert os.path.exists(filename) | 52 assert os.path.exists(filename) |
53 with open(filename) as f: | 53 with open(filename) as f: |
54 city_locations = locations(read_cities(f)) | 54 city_locations = locations(read_cities(f)) |
55 self.grid_locations(city_locations) | 55 self.grid_locations(city_locations) |
56 | 56 |
57 def test_neighbors(self): | |
58 """test grid neighbor indexing""" | |
59 | |
60 grid = LatLonGrid(9, 9) | |
61 | |
62 neighbors = grid.neighbors(5,5) | |
63 expected = [(4,4), (4,5), (4,6), | |
64 (5,4), (5,6), | |
65 (6,4), (6,5), (6,6)] | |
66 assert sorted(neighbors) == sorted(expected) | |
67 | |
57 | 68 |
58 ### generic (utility) functions | 69 ### generic (utility) functions |
59 | 70 |
60 def grid_locations(self, locations): | 71 def grid_locations(self, locations): |
61 """grid locations + test created grid""" | 72 """grid locations + test created grid""" |