Skip to content

Commit

Permalink
add type
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrrk committed Nov 27, 2024
1 parent 8307b3d commit 041a3f3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/rev_ai/models/asynchronous/group_channels_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
"""Enum for caption content types"""

from enum import Enum


class GroupChannelsType(Enum):
SPEAKER = 'speaker'
SENTENCE = 'sentence'
WORD = 'word'

@classmethod
def from_string(cls, status):
return cls[status.upper()]
22 changes: 16 additions & 6 deletions tests/test_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from src.rev_ai.apiclient import RevAiAPIClient
from src.rev_ai.models import RevAiApiDeploymentConfigMap, RevAiApiDeployment
from src.rev_ai.models.asynchronous import Transcript, Monologue, Element
from src.rev_ai.models.asynchronous.group_channels_type import GroupChannelsType

try:
from urllib.parse import urljoin
Expand All @@ -20,8 +21,17 @@

@pytest.mark.usefixtures('mock_session', 'make_mock_response')
class TestTranscriptEndpoints():
@pytest.mark.parametrize('group_channels_by, group_channels_threshold_ms', [(None, None), ('sentence', 5000), ('word', 2000)])
def test_get_transcript_text(self, mock_session, make_mock_response, group_channels_by, group_channels_threshold_ms):
@pytest.mark.parametrize(
'group_channels_by, group_channels_threshold_ms',
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
)
def test_get_transcript_text(
self,
mock_session,
make_mock_response,
group_channels_by,
group_channels_threshold_ms
):
data = 'Test'
client = RevAiAPIClient(TOKEN)
expected_headers = {'Accept': 'text/plain'}
Expand All @@ -46,7 +56,7 @@ def test_get_transcript_text_with_no_job_id(self, id, mock_session):

@pytest.mark.parametrize(
'group_channels_by, group_channels_threshold_ms',
[(None, None), ('sentence', 5000), ('word', 2000)]
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
)
def test_get_transcript_text_as_stream(
self,
Expand Down Expand Up @@ -80,7 +90,7 @@ def test_get_transcript_text_as_stream_with_no_job_id(self, id, mock_session):

@pytest.mark.parametrize(
'group_channels_by, group_channels_threshold_ms',
[(None, None), ('sentence', 5000), ('word', 2000)]
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
)
def test_get_transcript_json(
self,
Expand Down Expand Up @@ -124,7 +134,7 @@ def test_get_transcript_json_with_no_job_id(self, id, mock_session):

@pytest.mark.parametrize(
'group_channels_by, group_channels_threshold_ms',
[(None, None), ('sentence', 5000), ('word', 2000)]
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
)
def test_get_transcript_json_as_stream(
self,
Expand Down Expand Up @@ -168,7 +178,7 @@ def test_get_transcript_json_as_stream_with_no_job_id(self, id, mock_session):

@pytest.mark.parametrize(
'group_channels_by, group_channels_threshold_ms',
[(None, None), ('sentence', 5000), ('word', 2000)]
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
)
def test_get_transcript_object_with_success(
self,
Expand Down

0 comments on commit 041a3f3

Please sign in to comment.