예제 #1
0
def test_geocode_place_validation():
    """Should validate place for presence of name value
    """
    place = Place()
    assert not place.validate()
    place.name = 'place name'
    assert place.validate()
예제 #2
0
def test_geocode_place_validation():
    """Should validate place for presence of name value
    """
    place = Place()
    assert not place.validate()
    place.name = 'place name'
    assert place.validate()
예제 #3
0
def test_geocode_place_set_name():
    """Should get Place name from field other than coordinates if name is empty
    """
    pl = Place({
        'city': 'Portland',
        'country': 'Oregon',
        'coordinates': 'my coordinates'
    })
    pl.set_name()
    assert pl.name == 'Portland'
    pl.name = ''
    pl.city = ''
    pl.country = ''
    pl.set_name()
    assert pl.name == ''
예제 #4
0
def test_geocode_place_set_name():
    """Should get Place name from field other than coordinates if name is empty
    """
    pl = Place({'city': 'Portland', 
                'country': 'Oregon', 
                'coordinates': 'my coordinates'})
    pl.set_name()
    assert pl.name == 'Portland'
    pl.name = ''
    pl.city = ''
    pl.country = ''
    pl.set_name()
    assert pl.name == ''
예제 #5
0
def test_geocode_place_to_map_json():
    """Should convert Place to a dict and drop empty fields
    """
    INPUT = {'name': u'blah', 'coordinates': 'my coordinates'}
    assert Place(INPUT).to_map_json() == INPUT