Mercurial > hg > GlobalNeighbors
comparison tests/test_grid.py @ 3:49aae0c0293b
improved test coverage
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 24 Jun 2017 14:48:31 -0700 |
parents | 1b94f3bf97e5 |
children | 7e27e874655b |
comparison
equal
deleted
inserted
replaced
2:50ee13cddf58 | 3:49aae0c0293b |
---|---|
47 ### generic (utility) functions | 47 ### generic (utility) functions |
48 | 48 |
49 def grid_locations(self, locations): | 49 def grid_locations(self, locations): |
50 """grid locations + test created grid""" | 50 """grid locations + test created grid""" |
51 | 51 |
52 # create a grid | |
52 grid = LatLonGrid(8, 8) | 53 grid = LatLonGrid(8, 8) |
54 | |
55 # add the items to it | |
53 for geoid, (lat, lon) in locations.items(): | 56 for geoid, (lat, lon) in locations.items(): |
54 grid.add(geoid, lat, lon) | 57 grid.add(geoid, lat, lon) |
55 | 58 |
59 # iterate over the grid | |
60 n_locations = 0 | |
61 for i in range(grid.n[0]): | |
62 for j in range(grid.n[1]): | |
63 n_locations += len(grid[(i,j)]) | |
64 assert n_locations == len(locations) | |
65 | |
56 if __name__ == '__main__': | 66 if __name__ == '__main__': |
57 unittest.main() | 67 unittest.main() |