def test_special_languages_covered_by_smoke_test(): """All languages handled by wikipron.extract must have a smoke test.""" special_languages = {lang for lang in EXTRACTION_FUNCTIONS.keys()} smoke_test_languages = {lang.wik_name for lang in _SMOKE_TEST_LANGUAGES} assert special_languages.issubset(smoke_test_languages), ( "These languages must also be included in the smoke test: " f"{special_languages - smoke_test_languages}")
import pytest import requests_html from wikipron.extract import EXTRACTION_FUNCTIONS from wikipron.extract.core import _handle_parens, _skip_pron from wikipron.extract.default import extract_word_pron_default @pytest.mark.parametrize("func", tuple(EXTRACTION_FUNCTIONS.values()) + (extract_word_pron_default, )) def test_extraction_functions_have_the_same_signature(func): expected_annotations = { "word": "Word", "request": requests_html, "config": "Config", "return": "Iterator[WordPronPair]", } actual_annotations = func.__annotations__ assert expected_annotations == actual_annotations, ( f"{func.__qualname__} does not have the expected function signature.", ) @pytest.mark.parametrize( "pron, iso639_key, skip_spaces, expected", [ ("əbzɝvɚ", "eng", True, False), # GH-105: Dashed prons are skipped. ("ɑb-", "eng", True, True), # Spaces in Chinese prons are not skipped.
import pytest import requests from wikipron.extract import EXTRACTION_FUNCTIONS from wikipron.extract.core import _skip_pron from wikipron.extract.default import extract_word_pron_default from . import config_factory @pytest.mark.parametrize( "func", tuple(EXTRACTION_FUNCTIONS.values()) + (extract_word_pron_default,) ) def test_extraction_functions_have_the_same_signature(func): expected_annotations = { "word": "Word", "request": requests.Response, "config": "Config", "return": "Iterator[WordPronPair]", } actual_annotations = func.__annotations__ assert expected_annotations == actual_annotations, ( f"{func.__qualname__} does not have the expected function signature.", ) @pytest.mark.parametrize( "pron, iso639_key, expected", [ ("əbzɝvɚ", "eng", False), # GH-105: Dashed prons are skipped.