Mercurial > hg > GlobalNeighbors
diff 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 |
line wrap: on
line diff
--- a/tests/test_grid.py Sat Jun 24 14:04:00 2017 -0700 +++ b/tests/test_grid.py Sat Jun 24 14:48:31 2017 -0700 @@ -49,9 +49,19 @@ def grid_locations(self, locations): """grid locations + test created grid""" + # create a grid grid = LatLonGrid(8, 8) + + # add the items to it for geoid, (lat, lon) in locations.items(): grid.add(geoid, lat, lon) + # iterate over the grid + n_locations = 0 + for i in range(grid.n[0]): + for j in range(grid.n[1]): + n_locations += len(grid[(i,j)]) + assert n_locations == len(locations) + if __name__ == '__main__': unittest.main()