~linuxgoose/linguistics-robin

ref: caec89fb4ef61a639649e69c9ee2fd34094760ff linguistics-robin/tests/test_corner_cases.py -rw-r--r-- 684 bytes
caec89fb — Ilias Koutsakis fixed PyPI description (README.rst needed) 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pytest
from pyphonetics import Soundex, RefinedSoundex, FuzzySoundex
from pyphonetics.exceptions import EmptyStringError


def test_soundex():
    soundex = Soundex()

    assert soundex.phonetics('h') == 'H000'
    assert soundex.phonetics('d') == 'D000'

    with pytest.raises(EmptyStringError):
        soundex.phonetics('')


def test_refined_soundex():
    soundex = RefinedSoundex()

    assert soundex.phonetics('h') == 'H'
    assert soundex.phonetics('d') == 'D6'

    with pytest.raises(EmptyStringError):
        soundex.phonetics('')


def test_fuzzy_soundex():
    soundex = FuzzySoundex()

    with pytest.raises(EmptyStringError):
        soundex.phonetics('')