# Path: matcher/match.py
# def no_alpha(s):
#     def __init__(self, match_type, debug=None):
# def tidy_name(n):
# def drop_article(n):
# def strip_words(n):
# def initials_match(n1, n2, endings=None):
# def match_with_words_removed(osm, wd, words):
# def strip_non_chars_match(osm, wd, strip_dash=False):
# def prefix_name_match(osm, wd):
# def check_for_intials_match(initials, name):
# def strip_non_char_start(s):
# def strip_non_letter_start(s):
# def drop_initials(name):
# def split_on_upper(name):
# def split_on_upper_and_tidy(name):
# def name_containing_initials(n1, n2):
# def plural_word_name_in_other_name(n1, n2):
# def two_saints(n1, n2):
# def name_match_main(osm, wd, endings=None, debug=False):
#     def number_to_words_match(n1, n2):
# def strip_place_name(name, place_name):
# def more_place_name_varients(place_names):
# def match_two_streets(osm, wd, endings=None, **kwargs):
# def name_road_end_match(osm, wd, **kwargs):
# def name_match(osm, wd, endings=None, debug=False, place_names=None):
# def ordinal_number_to_word(name):
# def normalize_name(name):
# def has_address(osm_tags):
# def any_url_match(osm_value, values):
# def check_identifier(osm_tags, item_identifiers):
# def check_for_address_in_extract(osm_tags, extract):
#     def address_in_extract(address):
# def name_contains_housenumber(name):
# def check_name_matches_address(osm_tags, wikidata_names):
# def get_names(osm_tags):
# def intials_matches_other_wikidata_name(initials, wikidata_names):
# def strip_operator(name, operator):
# def check_for_match(osm_tags, wikidata_names, endings=None, place_names=None, trim_house=True):
# def get_all_matches(osm_tags, wikidata_names, endings=None):
# class Match(object):


from matcher import match
import pytest
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd, ['church of'])

    osm = 'Bromley Parish Church of St Peter & St Paul'
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd, ['Parish Church of'])

def test_get_names():
    assert match.get_names({}) == {}
    assert match.get_names({'name': 'test'}) == {'name': 'test'}
    assert match.get_names({'operator': 'test'}) == {'operator': 'test'}
    assert match.get_names({'name:left': 'test'}) == {}

@pytest.mark.skip(reason="get_wikidata_names is unused code")
def test_get_wikidata_names():
    item = {'labels': {}}
    assert match.get_wikidata_names(item) == {}

    item = {'labels': {'en': 'test'}}
    expect = {'test': [('label', 'en')]}
    assert dict(match.get_wikidata_names(item)) == expect

    item = {'labels': {'en': 'test', 'ar': 'test'}}
    assert dict(match.get_wikidata_names(item)) == expect

    item = {
        'labels': {'en': 'test', 'ar': 'test'},
        'sitelinks': {'enwiki': 'test', 'arwiki': 'test'},
    }
    expect = {'test': [('label', 'en'), ('sitelink', 'enwiki')]}

# Path: matcher/match.py
# def no_alpha(s):
#     def __init__(self, match_type, debug=None):
# def tidy_name(n):
# def drop_article(n):
# def strip_words(n):
# def initials_match(n1, n2, endings=None):
# def match_with_words_removed(osm, wd, words):
# def strip_non_chars_match(osm, wd, strip_dash=False):
# def prefix_name_match(osm, wd):
# def check_for_intials_match(initials, name):
# def strip_non_char_start(s):
# def strip_non_letter_start(s):
# def drop_initials(name):
# def split_on_upper(name):
# def split_on_upper_and_tidy(name):
# def name_containing_initials(n1, n2):
# def plural_word_name_in_other_name(n1, n2):
# def two_saints(n1, n2):
# def name_match_main(osm, wd, endings=None, debug=False):
#     def number_to_words_match(n1, n2):
# def strip_place_name(name, place_name):
# def more_place_name_varients(place_names):
# def match_two_streets(osm, wd, endings=None, **kwargs):
# def name_road_end_match(osm, wd, **kwargs):
# def name_match(osm, wd, endings=None, debug=False, place_names=None):
# def ordinal_number_to_word(name):
# def normalize_name(name):
# def has_address(osm_tags):
# def any_url_match(osm_value, values):
# def check_identifier(osm_tags, item_identifiers):
# def check_for_address_in_extract(osm_tags, extract):
#     def address_in_extract(address):
# def name_contains_housenumber(name):
# def check_name_matches_address(osm_tags, wikidata_names):
# def get_names(osm_tags):
# def intials_matches_other_wikidata_name(initials, wikidata_names):
# def strip_operator(name, operator):
# def check_for_match(osm_tags, wikidata_names, endings=None, place_names=None, trim_house=True):
# def get_all_matches(osm_tags, wikidata_names, endings=None):
# class Match(object):


# Path: tests/test_match.py
from matcher import match
import pytest

    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd, ['church of'])

    osm = 'Bromley Parish Church of St Peter & St Paul'
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd, ['Parish Church of'])

def test_get_names():
    assert match.get_names({}) == {}
    assert match.get_names({'name': 'test'}) == {'name': 'test'}
    assert match.get_names({'operator': 'test'}) == {'operator': 'test'}
    assert match.get_names({'name:left': 'test'}) == {}

@pytest.mark.skip(reason="get_wikidata_names is unused code")
def test_get_wikidata_names():
    item = {'labels': {}}
    assert match.get_wikidata_names(item) == {}

    item = {'labels': {'en': 'test'}}
    expect = {'test': [('label', 'en')]}
    assert dict(match.get_wikidata_names(item)) == expect

    item = {'labels': {'en': 'test', 'ar': 'test'}}
    assert dict(match.get_wikidata_names(item)) == expect

    item = {
        'labels': {'en': 'test', 'ar': 'test'},
        'sitelinks': {'enwiki': 'test', 'arwiki': 'test'},
    }
    expect = {'test': [('label', 'en'), ('sitelink', 'enwiki')]}

    assert dict(match.get_wikidata_names(item)) == expect