Ejemplo n.º 1
0
def test_CityCountry():
    city_name = 'Birmingham,England'

    db = AstralGeocoder()
    city = db[city_name]
    assert city.name == 'Birmingham'
    assert city.region == 'England'
Ejemplo n.º 2
0
def test_AllCities():
    db = AstralGeocoder()
    locations = db.locations
    locations.sort()

    for city_name in locations:
        _city = db[city_name]
Ejemplo n.º 3
0
def test_MultiCountryWithCountry():
    """Test for fix made due to bug report from Klaus Alexander Seistrup"""

    db = AstralGeocoder()
    city = db['Abu Dhabi,United Arab Emirates']
    assert city.name == 'Abu Dhabi'

    city = db['Abu Dhabi,UAE']
    assert city.name == 'Abu Dhabi'
Ejemplo n.º 4
0
def test_CandianCities():
    db = AstralGeocoder()

    city = db['Fredericton']
    assert city.elevation == 8
Ejemplo n.º 5
0
def test_Adelaide():
    """Test for fix made due to bug report from Klaus Alexander Seistrup"""

    db = AstralGeocoder()
    _city = db['Adelaide']
Ejemplo n.º 6
0
def test_MultiCountry():
    db = AstralGeocoder()
    city = db['Abu Dhabi']
    assert city.name == 'Abu Dhabi'
Ejemplo n.º 7
0
def test_GroupContainment():
    db = AstralGeocoder()
    assert 'africa' in db
Ejemplo n.º 8
0
def test_CityContainment():
    db = AstralGeocoder()
    assert 'london' in db
Ejemplo n.º 9
0
def test_UnknownGroup():
    with raises(AttributeError):
        db = AstralGeocoder()
        _e = db.wallyland
Ejemplo n.º 10
0
def test_Group():
    db = AstralGeocoder()
    _e = db.europe
Ejemplo n.º 11
0
#!/usr/bin/env python3

from astral import AstralGeocoder, Location

#Astral', 'AstralError', 'AstralGeocoder', 'GoogleGeocoder', 'Location', 'LocationGroup', 'SUN_RISING', 'SUN_SETTING', 'SunBelowHorizonError', 'URLError', '_LOCATION_INFO'

if __name__ == '__main__':

    coder = AstralGeocoder()

    for group in coder._groups:
        print('---', group, '---')

        for city in coder._groups[group]:
            print(city.name)