Skip to content

Commit 041a3f3

Browse files
committed
add type
1 parent 8307b3d commit 041a3f3

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- coding: utf-8 -*-
2+
"""Enum for caption content types"""
3+
4+
from enum import Enum
5+
6+
7+
class GroupChannelsType(Enum):
8+
SPEAKER = 'speaker'
9+
SENTENCE = 'sentence'
10+
WORD = 'word'
11+
12+
@classmethod
13+
def from_string(cls, status):
14+
return cls[status.upper()]

tests/test_transcript.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from src.rev_ai.apiclient import RevAiAPIClient
77
from src.rev_ai.models import RevAiApiDeploymentConfigMap, RevAiApiDeployment
88
from src.rev_ai.models.asynchronous import Transcript, Monologue, Element
9+
from src.rev_ai.models.asynchronous.group_channels_type import GroupChannelsType
910

1011
try:
1112
from urllib.parse import urljoin
@@ -20,8 +21,17 @@
2021

2122
@pytest.mark.usefixtures('mock_session', 'make_mock_response')
2223
class TestTranscriptEndpoints():
23-
@pytest.mark.parametrize('group_channels_by, group_channels_threshold_ms', [(None, None), ('sentence', 5000), ('word', 2000)])
24-
def test_get_transcript_text(self, mock_session, make_mock_response, group_channels_by, group_channels_threshold_ms):
24+
@pytest.mark.parametrize(
25+
'group_channels_by, group_channels_threshold_ms',
26+
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
27+
)
28+
def test_get_transcript_text(
29+
self,
30+
mock_session,
31+
make_mock_response,
32+
group_channels_by,
33+
group_channels_threshold_ms
34+
):
2535
data = 'Test'
2636
client = RevAiAPIClient(TOKEN)
2737
expected_headers = {'Accept': 'text/plain'}
@@ -46,7 +56,7 @@ def test_get_transcript_text_with_no_job_id(self, id, mock_session):
4656

4757
@pytest.mark.parametrize(
4858
'group_channels_by, group_channels_threshold_ms',
49-
[(None, None), ('sentence', 5000), ('word', 2000)]
59+
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
5060
)
5161
def test_get_transcript_text_as_stream(
5262
self,
@@ -80,7 +90,7 @@ def test_get_transcript_text_as_stream_with_no_job_id(self, id, mock_session):
8090

8191
@pytest.mark.parametrize(
8292
'group_channels_by, group_channels_threshold_ms',
83-
[(None, None), ('sentence', 5000), ('word', 2000)]
93+
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
8494
)
8595
def test_get_transcript_json(
8696
self,
@@ -124,7 +134,7 @@ def test_get_transcript_json_with_no_job_id(self, id, mock_session):
124134

125135
@pytest.mark.parametrize(
126136
'group_channels_by, group_channels_threshold_ms',
127-
[(None, None), ('sentence', 5000), ('word', 2000)]
137+
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
128138
)
129139
def test_get_transcript_json_as_stream(
130140
self,
@@ -168,7 +178,7 @@ def test_get_transcript_json_as_stream_with_no_job_id(self, id, mock_session):
168178

169179
@pytest.mark.parametrize(
170180
'group_channels_by, group_channels_threshold_ms',
171-
[(None, None), ('sentence', 5000), ('word', 2000)]
181+
[(None, None), (GroupChannelsType.SENTENCE, 5000), (GroupChannelsType.WORD, 2000)]
172182
)
173183
def test_get_transcript_object_with_success(
174184
self,

0 commit comments

Comments
 (0)