~linuxgoose/linguistics-robin

ref: d6c47107468e52dff819217157edc19caa29d5b1 linguistics-robin/tests/test_corner_cases.py -rw-r--r-- 684 bytes
d6c47107 — Jan Kölling limits version range of unidecode 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('')