File size: 725 Bytes
4c346eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pytest

from ether0.utils import contains_invalid


@pytest.mark.parametrize(
    ("text", "expected"),
    [
        pytest.param("COC-C=O-C=NC(=O)", (False, []), id="smiles"),
        pytest.param("Normal text", (False, []), id="plain-english-1"),
        pytest.param("موعد", (True, ["د", "ع", "م", "و"]), id="has-arabic-1"),
        pytest.param(
            "having a methyl[,mحصلة نفيسدكم](=O)",
            (True, ["ة", "ح", "د", "س", "ص", "ف", "ك", "ل", "م", "ن", "ي"]),
            id="has-arabic-2",
        ),
    ],
)
def test_contains_invalid_languages(
    text: str, expected: tuple[bool, list[str]]
) -> None:
    assert contains_invalid(text, languages=True) == expected