示例#1
0
def test_lookup_with_invalid_location():
    res = geolocation.lookup(location='foobar dne')
    assert res is None, res
示例#2
0
def test_reverse_lookup_with_invalid_key():
    res = geolocation.lookup(lat=37.368, lon=-122.03)
    assert res is None, res
示例#3
0
def test_lookup_with_valid_key():
    res = geolocation.lookup(location='Sunnyvale, CA')
    latLng = res['results'][0]['locations'][0]['latLng']
    assert latLng['lat'] == 37.36883, latLng
    assert latLng['lng'] == -122.03635, latLng
示例#4
0
def test_reverse_lookup_with_valid_key():
    res = geolocation.lookup(lat=37.368, lon=-122.03)
    assert res['address']['city'] == 'Sunnyvale', res
示例#5
0
def test_reverse_lookup_with_invalid_lat_lon():
    res = geolocation.lookup(lat=999, lon=999)
    assert res is None, res
示例#6
0
def test_reverse_lookup_with_invalid_lat_lon():
    res = geolocation.lookup(lat=999, lon=999)
    assert res is None, res
示例#7
0
def test_lookup_with_no_key():
    res = geolocation.lookup(location='Sunnyvale, CA')
    assert res is None, res
示例#8
0
def test_lookup_with_no_key():
    res = geolocation.lookup(location='Sunnyvale, CA')
    assert res is None, res
示例#9
0
def test_reverse_lookup_with_valid_key():
    res = geolocation.lookup(lat=37.368, lon=-122.03)
    assert res['address']['city'] == 'Sunnyvale', res
示例#10
0
def test_lookup_with_valid_key():
    res = geolocation.lookup(location='Sunnyvale, CA')
    latLng = res['results'][0]['locations'][0]['latLng']
    assert latLng['lat'] == 37.36883, latLng
    assert latLng['lng'] == -122.03635, latLng
示例#11
0
def test_lookup_with_invalid_location():
    res = geolocation.lookup(location='foobar dne')
    assert res is None, res
示例#12
0
def test_reverse_lookup_with_invalid_key():
    res = geolocation.lookup(lat=37.368, lon=-122.03)
    assert res is None, res
示例#13
0
def test_lookup_with_prefer_english_names_false():
    res = geolocation.lookup(lat=55.66333, lon=37.61583)
    assert res['address'][
        'city'] == u'\u041d\u0430\u0433\u043e\u0440\u043d\u044b\u0439 \u0440\u0430\u0439\u043e\u043d', res
示例#14
0
def test_lookup_with_prefer_english_names_true():
    res = geolocation.lookup(lat=55.66333, lon=37.61583)
    assert res['address']['city'] == 'Nagorny District', res