Skip to content

Commit d55fb5b

Browse files
committed
Update test-suites.
1 parent f1f39c5 commit d55fb5b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tests/test_chatbot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_estimate_fee(self):
4040
{'role': 'user', 'content': 'Hello'},
4141
]
4242
fee = bot.estimate_fee(messages)
43-
self.assertTrue(isclose(fee, 6e-06))
43+
self.assertTrue(isclose(fee, 2.1e-06))
4444

4545
def test_gpt_update_fee(self):
4646
bot = self.gpt_bot
@@ -55,7 +55,7 @@ def test_gpt_update_fee(self):
5555
bot.api_fees += [0]
5656
response3 = OpenAIResponse(usage=OpenAIUsage(prompt_tokens=300, completion_tokens=600, total_tokens=900))
5757
bot.update_fee(response3)
58-
self.assertListEqual(bot.api_fees, [0.00035, 0.0007, 0.00105])
58+
self.assertListEqual(bot.api_fees, [0.000135, 0.00027, 0.000405])
5959

6060
def test_claude_update_fee(self):
6161
bot = self.claude_bot

tests/test_openlrc.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
from openlrc.utils import extend_filename
1414

1515

16-
@patch('openlrc.transcribe.WhisperModel', MagicMock())
16+
@patch('openlrc.transcribe.BatchedInferencePipeline', MagicMock())
1717
@patch('openlrc.transcribe.Transcriber.transcribe',
1818
MagicMock(return_value=(
1919
[
2020
Segment(
21-
0, 0, 0, 3, 'hello world1', [], 0, 0.8, 0, 0, words=[
21+
0, 0, 0, 3, 'hello world1', [], 0.8, 0, 0, words=[
2222
Word(0, 1.5, 'hello', probability=0.8), Word(1.6, 3, ' world1', probability=0.8)
2323
]),
2424
Segment(
25-
0, 0, 3, 6, 'hello world2', [], 0, 0.8, 0, 0, words=[
25+
0, 0, 3, 6, 'hello world2', [], 0.8, 0, 0, words=[
2626
Word(3, 4.5, 'hello', probability=0.8), Word(4.6, 6, ' world2', probability=0.8)
2727
])
2828
],

tests/test_transcribe.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
return_tuple = ([
1313
Segment(
14-
0, 0, 0, 3, 'hello world', [], 0, 0.8, 0, 0, words=[
14+
0, 0, 0, 3, 'hello world', [], 0.8, 0, 0, words=[
1515
Word(0, 1.5, 'hello', probability=0.8),
1616
Word(1.6, 3, ' world', probability=0.8)
1717
]),
1818
Segment(
19-
0, 0, 3, 6, 'hello world', [], 0, 0.8, 0, 0, words=[
19+
0, 0, 3, 6, 'hello world', [], 0.8, 0, 0, words=[
2020
Word(3, 4.5, 'hello', probability=0.8),
2121
Word(4.6, 6, ' world', probability=0.8)
2222
]),
@@ -28,7 +28,7 @@ def setUp(self) -> None:
2828
self.audio_path = Path('data/test_audio.wav')
2929

3030
def test_transcribe_success(self):
31-
with patch('openlrc.transcribe.WhisperModel') as MockModel:
31+
with patch('openlrc.transcribe.BatchedInferencePipeline') as MockModel:
3232
MockModel.return_value.transcribe.return_value = return_tuple
3333

3434
transcriber = Transcriber(model_name='tiny')
@@ -37,7 +37,7 @@ def test_transcribe_success(self):
3737
self.assertEqual(round(info.duration), 30)
3838

3939
def test_audio_file_not_found(self):
40-
with patch('openlrc.transcribe.WhisperModel') as MockModel:
40+
with patch('openlrc.transcribe.BatchedInferencePipeline') as MockModel:
4141
MockModel.return_value.transcribe.return_value = return_tuple
4242

4343
transcriber = Transcriber(model_name='tiny')

tests/test_translate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from openlrc.translate import LLMTranslator
1111
from openlrc.utils import get_similarity
1212

13-
test_models = ['gpt-3.5-turbo', 'claude-3-haiku-20240307']
13+
test_models = ['gpt-4o-mini', 'claude-3-haiku-20240307']
1414

1515

1616
class TestLLMTranslator(unittest.TestCase):

0 commit comments

Comments
 (0)