~linuxgoose/linguistics-robin

ref: ba110fe71c3e4a7ef4cfec4dd7b23547b127c37c linguistics-robin/tests/test_corner_cases.py -rw-r--r-- 696 bytes
ba110fe7 — Jordan Robinson Merge pull request #8 from linuxgoose/6-rebrand---linguistics-robin 8 months 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 linguistics_robin import Soundex, RefinedSoundex, FuzzySoundex
from linguistics_robin.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('')