mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 18:37:58 +00:00
enable flake for Python tests
This commit is contained in:
@@ -16,6 +16,7 @@ import pytest
|
||||
from nominatim_api.search.postcode_parser import PostcodeParser
|
||||
from nominatim_api.search.query import QueryStruct, PHRASE_ANY, PHRASE_POSTCODE, PHRASE_STREET
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def pc_config(project_env):
|
||||
country_file = project_env.project_dir / 'country_settings.yaml'
|
||||
@@ -55,6 +56,7 @@ ky:
|
||||
|
||||
return project_env
|
||||
|
||||
|
||||
def mk_query(inp):
|
||||
query = QueryStruct([])
|
||||
phrase_split = re.split(r"([ ,:'-])", inp)
|
||||
@@ -80,6 +82,7 @@ def test_simple_postcode(pc_config, query, pos):
|
||||
|
||||
assert result == {(pos, pos + 1, '45325'), (pos, pos + 1, '453 25')}
|
||||
|
||||
|
||||
def test_contained_postcode(pc_config):
|
||||
parser = PostcodeParser(pc_config)
|
||||
|
||||
@@ -87,7 +90,6 @@ def test_contained_postcode(pc_config):
|
||||
(0, 2, '12345 DX')}
|
||||
|
||||
|
||||
|
||||
@pytest.mark.parametrize('query,frm,to', [('345987', 0, 1), ('345 987', 0, 2),
|
||||
('Aina 345 987', 1, 3),
|
||||
('Aina 23 345 987 ff', 2, 4)])
|
||||
@@ -98,6 +100,7 @@ def test_postcode_with_space(pc_config, query, frm, to):
|
||||
|
||||
assert result == {(frm, to, '345987')}
|
||||
|
||||
|
||||
def test_overlapping_postcode(pc_config):
|
||||
parser = PostcodeParser(pc_config)
|
||||
|
||||
@@ -131,6 +134,7 @@ def test_postcode_with_non_matching_country_prefix(pc_config):
|
||||
|
||||
assert not parser.parse(mk_query('ky12233'))
|
||||
|
||||
|
||||
def test_postcode_inside_postcode_phrase(pc_config):
|
||||
parser = PostcodeParser(pc_config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user