Formatting.
This commit is contained in:
parent
cd9c3b6e39
commit
a79fc533ee
11 changed files with 231 additions and 204 deletions
|
|
@ -1,14 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
from geocoder.geocoder import Geocoder, GeocodingTask, GeocodingCache
|
||||
|
||||
sys.path.append("..")
|
||||
from geocoder.geocoder import Geocoder, GeocodingTask, GeocodingCache
|
||||
|
||||
|
||||
def test_GeocodingTask():
|
||||
|
||||
good_address = 'Avinguda de la Republica Argentina 245, Barcelona'
|
||||
bad_address = 'ASdasda, 123asd'
|
||||
good_address = "Avinguda de la Republica Argentina 245, Barcelona"
|
||||
bad_address = "ASdasda, 123asd"
|
||||
|
||||
good_task = GeocodingTask(good_address)
|
||||
good_task.geocode()
|
||||
|
|
@ -20,25 +20,30 @@ def test_GeocodingTask():
|
|||
print(bad_address.is_successfull())
|
||||
print(bad_address.get_results())
|
||||
|
||||
|
||||
def test_GeocodingCache():
|
||||
|
||||
cache = GeocodingCache()
|
||||
|
||||
test_record = {'address':'Calle Don Pepito',
|
||||
'latitude': 12.1,
|
||||
'longitude': 1.12,
|
||||
'precision': 'absoluta'}
|
||||
test_record = {
|
||||
"address": "Calle Don Pepito",
|
||||
"latitude": 12.1,
|
||||
"longitude": 1.12,
|
||||
"precision": "absoluta",
|
||||
}
|
||||
|
||||
print(cache.address_in_cache(test_record['address']))
|
||||
cache.add_address(test_record['address'],
|
||||
test_record['latitude'],
|
||||
test_record['longitude'],
|
||||
test_record['precision'])
|
||||
print(cache.address_in_cache(test_record["address"]))
|
||||
cache.add_address(
|
||||
test_record["address"],
|
||||
test_record["latitude"],
|
||||
test_record["longitude"],
|
||||
test_record["precision"],
|
||||
)
|
||||
|
||||
print(cache.address_in_cache(test_record['address']))
|
||||
print(cache.get_coordinates(test_record['address']))
|
||||
print(cache.address_in_cache(test_record["address"]))
|
||||
print(cache.get_coordinates(test_record["address"]))
|
||||
|
||||
|
||||
#test_GeocodingTask()
|
||||
# test_GeocodingTask()
|
||||
|
||||
test_GeocodingCache()
|
||||
test_GeocodingCache()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue