예제 #1
0
def test_check_name_matches_address_postcode():
    tags = {
        'addr:housenumber': '12',
        'addr:street': 'Buckingham Street',
    }
    assert match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {
        'addr:housenumber': '12',
        'addr:street': 'Buckingham Street',
        'addr:postcode': 'WC2N 6DF',
    }
    assert match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {
        'addr:housenumber': '12',
        'addr:street': 'Buckingham Street',
        'addr:postcode': 'EC1X 1AA',
    }
    assert not match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {'addr:full': '12 Buckingham Street'}
    assert match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {
        'addr:postcode': '96813',
        'addr:housenumber': '250',
        'addr:city': 'Honolulu',
        'name': 'Hawaii State Art Museum',
        'building': 'yes',
        'addr:street': 'South Hotel Street',
    }

    wikidata_names = [
        'Hawaii State Art Museum',
        'No. 1 Capitol District Building',
        'Armed Services YMCA Building',
        'Hawaiʻi State Art Museum',
    ]
    assert match.check_name_matches_address(tags, wikidata_names) is not False

    tags = {
        'name': '510 Marquette',
        'addr:housenumber': '510',
        'addr:street': 'Marquette Avenue South',
    }
    wikidata_names = ['510 Marquette Building']
    assert match.check_name_matches_address(tags, wikidata_names) is not False

    tags = {
        'addr:street': 'Poydras Street',
        'name': 'Eni Building',
        'building': 'yes',
        'addr:housenumber': '1250',
        'height': '104',
        'wikidata': 'Q4548391',
    }
    wikidata_names = ['1250 Poydras Plaza', 'Mobil Building', 'Eni Building']
    assert match.check_name_matches_address(tags, wikidata_names) is not False
예제 #2
0
def test_embassy_match():
    tags = {
        'name': 'Consulate General of Switzerland in San Francisco',
        'amenity': 'embassy',
        'country': 'CH',
        'addr:city': 'San Francisco',
        'addr:state': 'CA',
        'addr:street': 'Montgomery Street',
        'addr:postcode': '94104',
        'addr:housenumber': '456',
    }

    wd_address = '456 Montgomery Street Suite #2100'
    assert match.check_name_matches_address(tags, [wd_address]) is not False
예제 #3
0
def test_check_name_matches_address_postcode():
    tags = {
        'addr:housenumber': '12',
        'addr:street': 'Buckingham Street',
    }
    assert match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {
        'addr:housenumber': '12',
        'addr:street': 'Buckingham Street',
        'addr:postcode': 'WC2N 6DF',
    }
    assert match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {
        'addr:housenumber': '12',
        'addr:street': 'Buckingham Street',
        'addr:postcode': 'EC1X 1AA',
    }
    assert not match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {'addr:full': '12 Buckingham Street'}
    assert match.check_name_matches_address(tags, ['12, Buckingham Street Wc2'])

    tags = {
        'name': '510 Marquette',
        'addr:housenumber': '510',
        'addr:street': 'Marquette Avenue South',
    }
    wikidata_names = ['510 Marquette Building']
    assert match.check_name_matches_address(tags, wikidata_names) is not False

    tags = {
        'addr:street': 'Poydras Street',
        'name': 'Eni Building',
        'building': 'yes',
        'addr:housenumber': '1250',
        'height': '104',
        'wikidata': 'Q4548391',
    }
    wikidata_names = ['1250 Poydras Plaza', 'Mobil Building', 'Eni Building']
    assert match.check_name_matches_address(tags, wikidata_names) is not False
예제 #4
0
def test_check_name_matches_address():
    assert not match.check_name_matches_address({}, [])

    tags = {'addr:housenumber': '12', 'addr:street': 'Station Road'}
    assert match.check_name_matches_address(tags, ['12 Station Road'])
    assert match.check_name_matches_address(tags, ['12, Station Road'])
    assert match.check_name_matches_address(tags, ['Number 12 Station Road'])
    tags = {'addr:housenumber': '12-14', 'addr:street': 'Station Road'}
    assert match.check_name_matches_address(tags, ['Nos 12-14 Station Road'])

    assert not match.check_name_matches_address(tags, ['Station Road'])

    tags = {'addr:full': '12 Station Road'}
    assert match.check_name_matches_address(tags, ['12 Station Road'])

    tags = {'addr:full': 'Station Road'}
    assert not match.check_name_matches_address(tags, ['12 Station Road'])

    tags = {
        'addr:street': 'Krakowskie Przedmieście',
        'addr:housenumber': '66',
        'addr:postcode': '00-322',
        'name': 'Centralna Biblioteka Rolnicza',
    }

    wd_address = '66 Krakowskie Przedmieście Street in Warsaw'
    assert match.check_name_matches_address(tags, [wd_address]) is not False

    tags = {
        'name': '100 East Wisconsin',
        'addr:state': 'WI',
        'addr:street': 'East Wisconsin Avenue',
        'addr:city': 'Milwaukee',
        'addr:postcode': '53202',
        'addr:housenumber': '100',
    }
    wd_address = '100 East Wisconsin'
    assert match.check_name_matches_address(tags, [wd_address]) is not False

    tags = {
        'name': '1000 Second Avenue',
        'addr:housenumber': '1000',
        'addr:street': '2nd Avenue',
        'addr:city': 'Seattle',
        'addr:postcode': '98104',
    }
    wd_address = '1000 Second Avenue'
    assert match.check_name_matches_address(tags, [wd_address]) is not False

    tags = {
        'name': '1300 Lafayette East Cooperative',
        'addr:housenumber': '1300',
        'addr:street': 'Lafayette Street East',
        'addr:city': 'Detroit',
    }
    wd_address = '1300 Lafayette East Cooperative'
    assert match.check_name_matches_address(tags, [wd_address]) is not False

    tags = {
        'addr:city': 'Kraków',
        'addr:country': 'PL',
        'addr:housenumber': '3',
        'addr:postcode': '31-134',
        'addr:street': 'Basztowa',
        'building': 'apartments',
    }
    wd_address = 'Basztowa 3'
    # assert match.check_name_matches_address(tags, [wd_address]) is not False

    wd_address = '3 Basztowa street in Kraków'
    assert match.check_name_matches_address(tags, [wd_address]) is True

    wd_address = '4 Basztowa street in Kraków'
    assert match.check_name_matches_address(tags, [wd_address]) is False