File size: 1,100 Bytes
4a9ec15
 
 
8da917e
 
 
4a9ec15
 
 
 
 
 
 
 
8da917e
 
4a9ec15
 
8da917e
 
 
4a9ec15
 
8da917e
 
 
 
4a9ec15
 
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 re

from app.core.config import get_settings
from app.services.transcriber import _normalise_transcript_text


def _get_test_replacements():
    replacements = get_settings().TRANSCRIBE_REPLACEMENTS
    return tuple(
        (re.compile(pattern, re.IGNORECASE), replacement)
        for pattern, replacement in replacements.items()
    )


def test_normalise_walk_experience_to_work_experience() -> None:
    query = "uh what is his walk experience in a professional setting"
    replacements = _get_test_replacements()
    assert _normalise_transcript_text(query, replacements) == "what is his work experience in a professional setting"


def test_normalise_text_stack_to_tech_stack() -> None:
    replacements = _get_test_replacements()
    assert _normalise_transcript_text("what text stack does he use", replacements) == "what tech stack does he use"


def test_keeps_clean_transcript_unchanged() -> None:
    original = "What technologies and skills does he work with?"
    replacements = _get_test_replacements()
    assert _normalise_transcript_text(original, replacements) == original