Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions tests/tests/audio_tests/test_get_transcript.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import pytest
from tests.utils.resource_utils import get_resource_path

@pytest.mark.skip(reason="Need to deploy ASR first")

def test_get_transcription(textual_audio):
path = get_resource_path('banking_customer_support.mp3')
path = get_resource_path("banking_customer_support.mp3")
transcript = textual_audio.get_audio_transcript(path)
assert transcript.language=="english" or transcript.language=="en"
assert len(transcript.segments)>0
assert len(transcript.text)>100
assert transcript.language == "english" or transcript.language == "en"
assert len(transcript.segments) > 0
assert len(transcript.text) > 100
7 changes: 3 additions & 4 deletions tests/tests/audio_tests/test_redact_audio_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from tests.utils.resource_utils import get_resource_path

@pytest.mark.skip(reason="Need to deploy ASR first")

def test_redact_audio_file_does_not_throw(textual_audio):
path = get_resource_path('banking_customer_support.mp3')
textual_audio.redact_audio_file(path, 'output.mp3')
path = get_resource_path("banking_customer_support.mp3")
textual_audio.redact_audio_file(path, "output.mp3")
24 changes: 15 additions & 9 deletions tests/tests/audio_tests/test_redact_transcript.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import re
import pytest
from tests.utils.resource_utils import get_resource_path

@pytest.mark.skip(reason="Need to deploy ASR first")

def test_redact_transcript(textual_audio):
path = get_resource_path('banking_customer_support.mp3')
path = get_resource_path("banking_customer_support.mp3")
transcript = textual_audio.get_audio_transcript(path)
assert len(transcript.segments)>0, "confirming transcript is likely valid before redacting"
assert len(transcript.segments) > 0, (
"confirming transcript is likely valid before redacting"
)

redacted_transcript = textual_audio.redact_audio_transcript(transcript, generator_default='Off',generator_config={'NAME_GIVEN':'Redaction'})
redacted_transcript = textual_audio.redact_audio_transcript(
transcript,
generator_default="Off",
generator_config={"NAME_GIVEN": "Redaction"},
)

assert len(redacted_transcript.redacted_segments)==len(transcript.segments)

assert len(redacted_transcript.redacted_segments) == len(transcript.segments)

NAME_GIVEN_RE = re.compile(r'\[NAME_GIVEN_[^\]]+\]')
assert bool(NAME_GIVEN_RE.search(redacted_transcript.redacted_text)), "assert we found a redacted first name"
NAME_GIVEN_RE = re.compile(r"\[NAME_GIVEN_[^\]]+\]")
assert bool(NAME_GIVEN_RE.search(redacted_transcript.redacted_text)), (
"assert we found a redacted first name"
)