Mercurial > hg > GlobalNeighbors
comparison tests/test_deteremine_distances.py @ 0:5dba84370182
initial commit; half-working prototype
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 24 Jun 2017 12:03:39 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:5dba84370182 |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 """ | |
4 test converstion: geoids intermediary to distances | |
5 """ | |
6 | |
7 import json | |
8 import os | |
9 import unittest | |
10 from globalneighbors.determine_distances import geoids2distances | |
11 | |
12 here = os.path.dirname(os.path.abspath(__file__)) | |
13 data = os.path.join(here, 'data') | |
14 | |
15 class DetermineDistncesTest(unittest.TestCase): | |
16 | |
17 # full dataset: test with caution | |
18 full_tsv = os.path.join(data, 'cities1000.txt') | |
19 full_tsv_lines = 149092 | |
20 | |
21 # neighbors within +/- 1 degree lat or lon from each other | |
22 twodegrees = os.path.join(data, '2degrees.json') | |
23 | |
24 def test_2degrees(self): | |
25 """test cities within 2 degrees lat, lon of each other""" | |
26 | |
27 # ensure our fixtures exist | |
28 assert os.path.exists(self.full_tsv) | |
29 assert os.path.exists(self.twodegrees) | |
30 | |
31 # read neighbors file | |
32 with open(self.twodegrees) as f: | |
33 twodegrees = json.loads(f.read()) | |
34 | |
35 | |
36 if __name__ == '__main__': | |
37 unittest.main() |