X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/62d5984b1bf4f121159ae49c88ac6d3d9a2ea619..834ae0a93f2f25b3231f4c47612ac1d2c170738a:/test/python/test_tokenizer_icu_name_processor.py?ds=sidebyside diff --git a/test/python/test_tokenizer_icu_name_processor.py b/test/python/test_tokenizer_icu_name_processor.py index cc103116..ae05988a 100644 --- a/test/python/test_tokenizer_icu_name_processor.py +++ b/test/python/test_tokenizer_icu_name_processor.py @@ -4,6 +4,7 @@ Tests for import name normalisation and variant generation. from textwrap import dedent import pytest +import yaml from nominatim.tokenizer.icu_rule_loader import ICURuleLoader from nominatim.tokenizer.icu_name_processor import ICUNameProcessor, ICUNameProcessorRules @@ -11,7 +12,7 @@ from nominatim.tokenizer.icu_name_processor import ICUNameProcessor, ICUNameProc from nominatim.errors import UsageError @pytest.fixture -def cfgfile(tmp_path, suffix='.yaml'): +def cfgfile(): def _create_config(*variants, **kwargs): content = dedent("""\ normalization: @@ -29,9 +30,7 @@ def cfgfile(tmp_path, suffix='.yaml'): content += '\n'.join((" - " + s for s in variants)) + '\n' for k, v in kwargs: content += " {}: {}\n".format(k, v) - fpath = tmp_path / ('test_config' + suffix) - fpath.write_text(dedent(content)) - return fpath + return yaml.safe_load(content) return _create_config