forked from thampiman/reverse-geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
19 lines (17 loc) · 814 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from timeit import timeit
import csv
import reverse_geocoder as rg
if __name__ == '__main__':
setup = "import csv;import reverse_geocoder as rg;print('Loading coordinates...');" + \
"cities = [(row[0],row[1]) for row in csv.reader(open('../test/coordinates_10000000.csv','rt'),delimiter='\t')];"
num = 3
t = timeit(stmt="rg.search(cities,mode=1)",setup=setup,number=num)
print('Running time: %.2f secs' % (t / num))
print('\nLoading coordinates to compare mode 1 and mode 2...')
cities = [(row[0],row[1]) for row in csv.reader(open('../test/coordinates_1000.csv','rt'),delimiter='\t')]
result1 = rg.search(cities,mode=1)
result2 = rg.search(cities,mode=2)
if result1 != result2:
print('Results do not match!')
else:
print('Both results match!')