repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from email.message import EmailMessage
from functools import partial
from unittest.mock import mock_open, patch
from email_plugin import (
adjust_imap_folder_for_gmail,
bothEmailAndPwdSet,
enclose_with_quotes,
imap_open,
read_emails,
send_email,
send_email_with_att... | "Sent") | self.assertEqual | string_literal | src/autogpt_plugins/email/email_plugin/test_email_plugin.py | test_adjust_imap_folder_for_gmail_non_gmail_sender | TestEmailPlugin | 120 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from typing import List
import requests
from . import AutoGPTBingSearch
from .bing_search import _bing_search
class TestAutoGPTBingSearch(unittest.TestCase):
def setUp(self):
os.environ["BING_API_KEY"] = "test_key"
os.environ["SEARCH_ENGINE"] = "bing"
self.plugin... | {"query": "test query"}) | self.assertEqual | collection | src/autogpt_plugins/bing_search/test_auto_gpt_bing.py | test_pre_command | TestAutoGPTBingSearch | 36 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from typing import List
import requests
import requests_mock
from . import AutoGPTSerpApiSearch
from .serpapi_search import serpapi_search, _filter_results, _get_params
class TestAutoGPTSerpApiSearch(unittest.TestCase):
json_data = {
"field1": 1,
"field2": [1, 2, "3"],
... | {"field1": 1, "field3": {"b": 2, "c": "3"}}) | self.assertDictEqual | collection | src/autogpt_plugins/serpapi/test_serpapi_plugin.py | test_filter_results_top_level_second_level_dict | TestAutoGPTSerpApiSearch | 82 | null |
Significant-Gravitas/Auto-GPT-Plugins | import json
from unittest.mock import Mock
import pytest
from .news_search import NewsSearch
class TestNewsSearch:
def mock_response(self, *args, **kwargs):
# Mock Response of NewsAPI. We have result for AutoGPT in technology but not others,
# whereas Cricket is present in Sports/Entertainment bu... | 5 | assert | numeric_literal | src/autogpt_plugins/news_search/test_auto_gpt_news_search.py | test_news_search | TestNewsSearch | 46 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from typing import List
import requests
import requests_mock
from . import AutoGPTSerpApiSearch
from .serpapi_search import serpapi_search, _filter_results, _get_params
class TestAutoGPTSerpApiSearch(unittest.TestCase):
json_data = {
"field1": 1,
"field2": [1, 2, "3"],
... | {"field1": 1, "field3": {"a": 1, "b": 2, "c": "3"}}) | self.assertDictEqual | collection | src/autogpt_plugins/serpapi/test_serpapi_plugin.py | test_filter_results_top_level | TestAutoGPTSerpApiSearch | 72 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from typing import List
import requests
from . import AutoGPTBaiduSearch
from .baidu_search import _baidu_search
class TestAutoGPTBaiduSearch(unittest.TestCase):
def setUp(self):
os.environ["BAIDU_COOKIE"] = "test_cookie"
os.environ["SEARCH_ENGINE"] = "baidu"
sel... | self.plugin.can_handle_pre_command()) | self.assertTrue | func_call | src/autogpt_plugins/baidu_search/test_auto_gpt_baidu_plugin.py | test_can_handle_pre_command | TestAutoGPTBaiduSearch | 39 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from .bluesky_plugin import get_latest_posts, post_message, username_and_pwd_set
MOCK_USERNAME = "example.bsky.social"
MOCK_MESSAGE = "Hello, World!"
class TestBlueskyPlugin(unittest.TestCase):
def setUp(self):
os.environ["BLUESKY_USERNAME"] = "example.bsky.social"
os.en... | username_and_pwd_set()) | self.assertTrue | func_call | src/autogpt_plugins/bluesky/bluesky_plugin/test_bluesky_plugin.py | test_username_and_pwd_set | TestBlueskyPlugin | 20 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from email.message import EmailMessage
from functools import partial
from unittest.mock import mock_open, patch
from email_plugin import (
adjust_imap_folder_for_gmail,
bothEmailAndPwdSet,
enclose_with_quotes,
imap_open,
read_emails,
send_email,
send_email_with_att... | "ALL" | assert | string_literal | src/autogpt_plugins/email/email_plugin/test_email_plugin.py | test_enclose_with_quotes | TestEmailPlugin | 137 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from email.message import EmailMessage
from functools import partial
from unittest.mock import mock_open, patch
from email_plugin import (
adjust_imap_folder_for_gmail,
bothEmailAndPwdSet,
enclose_with_quotes,
imap_open,
read_emails,
send_email,
send_email_with_att... | []) | self.assertEqual | collection | src/autogpt_plugins/email/email_plugin/test_email_plugin.py | test_split_imap_search_command | TestEmailPlugin | 165 | null |
Significant-Gravitas/Auto-GPT-Plugins | import os
import unittest
from typing import List
import requests
import requests_mock
from . import AutoGPTSerpApiSearch
from .serpapi_search import serpapi_search, _filter_results, _get_params
class TestAutoGPTSerpApiSearch(unittest.TestCase):
json_data = {
"field1": 1,
"field2": [1, 2, "3"],
... | [ { "title": "title 1", "link": "https://example1.com", "snippet": "snippet 1", }, { "title": "title 2", "link": "https://example2.com", "snippet": "snippet 2", }, ]) | self.assertListEqual | collection | src/autogpt_plugins/serpapi/test_serpapi_plugin.py | test_serpapi_search_default | TestAutoGPTSerpApiSearch | 156 | null |
Significant-Gravitas/Auto-GPT-Plugins | import json
import string
from unittest.mock import Mock
from unittest import TestCase
class TestRandomValueCommands(TestCase):
def setUp(self):
self.random_values = RandomValues(Mock())
def test_random_number_using_missing_count(self):
result = json.loads(self.random_values.random_number(min... | 1) | self.assertEqual | numeric_literal | src/autogpt_plugins/random_values/test_random_valaues.py | test_random_number_using_missing_count | TestRandomValueCommands | 42 | null |
Significant-Gravitas/Auto-GPT-Plugins | import json
from unittest.mock import Mock
import pytest
from .news_search import NewsSearch
class TestNewsSearch:
def mock_response(self, *args, **kwargs):
# Mock Response of NewsAPI. We have result for AutoGPT in technology but not others,
# whereas Cricket is present in Sports/Entertainment bu... | 0 | assert | numeric_literal | src/autogpt_plugins/news_search/test_auto_gpt_news_search.py | test_news_search | TestNewsSearch | 54 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | b['status']) | self.assertEqual | complex_expr | tests/command_test.py | snippet_call_test | TestTest | 36 | null |
online-judge-tools/oj | import hashlib
import os
import unittest
import onlinejudge_command.subcommand.download as subcommand_download
import tests.utils
from onlinejudge_command.main import get_parser
def get_files_from_json(samples):
files = {}
for i, sample in enumerate(samples):
for ext in ('in', 'out'):
if '... | subcommand_download.run(args)) | self.assertTrue | func_call | tests/command_download.py | snippet_call_download_twice | 64 | null | |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | 3) | assert_* | numeric_literal | tests/command_test.py | test_call_test_special_judge | TestTest | 376 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command.format_utils import *
class PercentFormatTest(unittest.TestCase):
def test_percentformat(self):
self.assertEqual(percentformat("foo %a%a bar %b", {"a": "AA", "b": "12345"}), | 'foo AAAA bar 12345') | self.assertEqual | string_literal | tests/format_utils.py | test_percentformat | PercentFormatTest | 8 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | 'AC') | self.assertEqual | string_literal | tests/command_test.py | test_call_test_not_tle | TestTest | 985 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | 0) | self.assertNotEqual | numeric_literal | tests/command_test.py | test_call_test_check_no_orphan_with_keyboard_interrupt | TestTest | 1,322 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command.format_utils import *
class PercentFormatTest(unittest.TestCase):
def test_percentformat(self):
self.assertEqual(percentformat("foo %a%a bar %b", {"a": "AA", "b": "12345"}), 'foo AAAA bar 12345')
self.assertEqual(percentformat("foo %%a bar %%%a %b", {"a": ... | 'foo %a bar %%a%b 12345') | self.assertEqual | string_literal | tests/format_utils.py | test_percentformat | PercentFormatTest | 9 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command import main
class RequestExceptionTest(unittest.TestCase):
def test_invalid_url(self):
with self.assertRaises(SystemExit) as e:
main.main(["d", "http://invalid_contest"])
self.assertEqual(e.exception.code, | 1) | self.assertEqual | numeric_literal | tests/main.py | test_invalid_url | RequestExceptionTest | 10 | null |
online-judge-tools/oj | import os
import unittest
import tests.utils
class GenerateInputTest(unittest.TestCase):
def snippet_call_generate_input(self, args, input_files, expected_values, disallowed_files=None):
with tests.utils.sandbox(input_files) as _:
tests.utils.run(['generate-input'] + args, check=True)
... | os.path.exists(file)) | self.assertFalse | func_call | tests/command_generate_input.py | snippet_call_generate_input | GenerateInputTest | 18 | null |
online-judge-tools/oj | import hashlib
import os
import unittest
import onlinejudge_command.subcommand.download as subcommand_download
import tests.utils
from onlinejudge_command.main import get_parser
def get_files_from_json(samples):
files = {}
for i, sample in enumerate(samples):
for ext in ('in', 'out'):
if '... | ('files', 'json') | assert | collection | tests/command_download.py | snippet_call_download | 23 | null | |
online-judge-tools/oj | import hashlib
import os
import unittest
import onlinejudge_command.subcommand.download as subcommand_download
import tests.utils
from onlinejudge_command.main import get_parser
def get_files_from_json(samples):
files = {}
for i, sample in enumerate(samples):
for ext in ('in', 'out'):
if '... | result) | self.assertEqual | variable | tests/command_download.py | snippet_call_download | 39 | null | |
online-judge-tools/oj | import os
import unittest
import tests.utils
class GenerateInputTest(unittest.TestCase):
def snippet_call_generate_input(self, args, input_files, expected_values, disallowed_files=None):
with tests.utils.sandbox(input_files) as _:
tests.utils.run(['generate-input'] + args, check=True)
... | os.path.exists(expect['path'])) | self.assertTrue | func_call | tests/command_generate_input.py | snippet_call_generate_input | GenerateInputTest | 12 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command.format_utils import *
class PercentFormatTest(unittest.TestCase):
def test_percentformat(self):
self.assertEqual(percentformat("foo %a%a bar %b", {"a": "AA", "b": "12345"}), 'foo AAAA bar 12345')
self.assertEqual(percentformat("foo %%a bar %%%a %b", {"a": "... | KeyError) | self.assertRaises | variable | tests/format_utils.py | test_percentformat | PercentFormatTest | 10 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | fh.read()) | self.assertNotIn | func_call | tests/command_test.py | test_call_test_check_no_orphan_with_keyboard_interrupt | TestTest | 1,327 | null |
online-judge-tools/oj | import pathlib
import textwrap
import unittest
from onlinejudge.type import Language, LanguageId
from onlinejudge_command.subcommand import submit
languages_atcoder_3 = [
Language(id=LanguageId('3001'), name='Bash (GNU bash v4.3.11)'),
Language(id=LanguageId('3002'), name='C (GCC 5.4.1)'),
Language(id=Lan... | expected) | self.assertEqual | variable | tests/implementation_language_guessing.py | test_atcoder_3_gcc | LanguageGuessingCPlusPlusTest | 182 | null |
online-judge-tools/oj | import contextlib
import os
import pathlib
import subprocess
import sys
import tempfile
from typing import *
def chdir(path):
cwd = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(cwd)
def prepare_files(files):
for f in files:
path = pathlib.Path(f['path'])
... | cmd | assert | variable | tests/utils.py | python_c | 70 | null | |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | user_output) | assert_* | variable | tests/command_test.py | assert_each_line_count | TestTest | 370 | null |
online-judge-tools/oj | import os
import shutil
import time
import unittest
import requests.exceptions
import tests.utils
from onlinejudge.service.atcoder import AtCoderService
from onlinejudge.service.codeforces import CodeforcesService
from onlinejudge.service.hackerrank import HackerRankService
from onlinejudge.service.toph import TophSe... | url.startswith('https://atcoder.jp/contests/practice/submissions/')) | self.assertTrue | func_call | tests/command_submit.py | test_call_submit_atcoder_practice_1_with_open | SubmitArgumentsTest | 70 | null |
online-judge-tools/oj | import os
import unittest
import tests.utils
from tests.utils import cat
class GenerateOutputTest(unittest.TestCase):
def snippet_call_generate_output(self, args, input_files, expected_values, disallowed_files=None):
with tests.utils.sandbox(input_files) as _:
tests.utils.run(['generate-output... | expect['data']) | self.assertEqual | complex_expr | tests/command_generate_output.py | snippet_call_generate_output | GenerateOutputTest | 14 | null |
online-judge-tools/oj | import os
import shutil
import time
import unittest
import requests.exceptions
import tests.utils
from onlinejudge.service.atcoder import AtCoderService
from onlinejudge.service.codeforces import CodeforcesService
from onlinejudge.service.hackerrank import HackerRankService
from onlinejudge.service.toph import TophSe... | requests.exceptions.HTTPError) | self.assertRaises | complex_expr | tests/command_submit.py | test_call_submit_atcoder_invalid_url | SubmitArgumentsTest | 95 | null |
online-judge-tools/oj | import contextlib
import os
import pathlib
import subprocess
import sys
import tempfile
from typing import *
def chdir(path):
cwd = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(cwd)
def prepare_files(files):
for f in files:
path = pathlib.Path(f['path'])
... | path | assert | variable | tests/utils.py | python_script | 75 | null | |
online-judge-tools/oj | import os
import unittest
import tests.utils
from tests.utils import cat
class GenerateOutputTest(unittest.TestCase):
def snippet_call_generate_output(self, args, input_files, expected_values, disallowed_files=None):
with tests.utils.sandbox(input_files) as _:
tests.utils.run(['generate-output... | os.path.exists(file)) | self.assertFalse | func_call | tests/command_generate_output.py | snippet_call_generate_output | GenerateOutputTest | 17 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | testcase_input) | assert_* | variable | tests/command_test.py | assert_each_line_count | TestTest | 370 | null |
online-judge-tools/oj | import textwrap
import unittest
from typing import *
from onlinejudge_command.output_comparators import CompareMode
from onlinejudge_command.pretty_printers import _LineDiffOp, _make_diff_between_file_and_file, _PrettyToken, _PrettyTokenType, _render_tokens, _tokenize_file_content_without_snipping, _tokenize_large_fil... | expected) | self.assertEqual | variable | tests/pretty_printers.py | test_simple | TokenizeLineTest | 21 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command.output_comparators import *
class ExactComparatorTest(unittest.TestCase):
def test_same(self) -> None:
x = b'Hello, world!'
y = b'Hello, world!'
result = True
compare = ExactComparator()
self.assertEqual(compare(x, y), | result) | self.assertEqual | variable | tests/output_comparators.py | test_same | ExactComparatorTest | 16 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command import main
class RequestExceptionTest(unittest.TestCase):
def test_invalid_url(self):
with self.assertRaises( | SystemExit) | self.assertRaises | variable | tests/main.py | test_invalid_url | RequestExceptionTest | 8 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | 'TLE') | self.assertEqual | string_literal | tests/command_test.py | test_call_test_tle | TestTest | 971 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command.format_utils import *
class PercentFormatTest(unittest.TestCase):
def test_percentparse(self):
self.assertEqual(percentparse("foo AAAA bar 12345", "foo %a%a bar %b", {"a": "AA", "b": "12345"}), {'a': 'AA', 'b': '12345'})
self.assertEqual(percentparse("123... | {'x': '12345', 'y': '6', 'z': '789'}) | self.assertEqual | collection | tests/format_utils.py | test_percentparse | PercentFormatTest | 14 | null |
online-judge-tools/oj | import unittest
from onlinejudge_command.format_utils import *
class PercentFormatTest(unittest.TestCase):
def test_percentparse(self):
self.assertEqual(percentparse("foo AAAA bar 12345", "foo %a%a bar %b", {"a": "AA", "b": "12345"}), | {'a': 'AA', 'b': '12345'}) | self.assertEqual | collection | tests/format_utils.py | test_percentparse | PercentFormatTest | 13 | null |
online-judge-tools/oj | import unittest
import tests.utils
class PrintVersionTest(unittest.TestCase):
def test_version(self):
pattern = rb'^online-judge-tools \d+\.\d+\.\d+ \(\+ online-judge-api-client \d+\.\d+\.\d+\)$'
result = tests.utils.run_in_sandbox(args=['--version'], files=[])
self.assertRegex(result['pr... | pattern) | self.assertRegex | variable | tests/command_version.py | test_version | PrintVersionTest | 10 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | testcase_output) | assert_* | variable | tests/command_test.py | assert_each_line_count | TestTest | 370 | null |
online-judge-tools/oj | import json
import os
import pathlib
import platform
import random
import signal
import sys
import tempfile
import threading
import unittest
from typing import *
import tests.utils
from tests.utils import cat, sleep_1sec
class TestTest(unittest.TestCase):
def snippet_call_test(self, args, files, expected, verbose... | 1000) | self.assertLess | numeric_literal | tests/command_test.py | test_call_test_large_memory | TestTest | 1,004 | null |
speaches-ai/speaches | import openai
from openai import AsyncOpenAI
import pytest
MODEL_ID_THAT_EXISTS = "Systran/faster-whisper-tiny.en"
MODEL_ID_THAT_DOES_NOT_EXIST = "i-do-not-exist"
MIN_EXPECTED_NUMBER_OF_MODELS = 70 # At the time of the test creation there are 89 models
@pytest.mark.parametrize("pull_model_without_cleanup", [MODEL_ID... | MODEL_ID_THAT_EXISTS | assert | variable | tests/api_model_test.py | test_model_exists | 22 | null | |
speaches-ai/speaches | from collections.abc import AsyncGenerator
from httpx import AsyncClient
from pydantic import SecretStr
import pytest
import pytest_asyncio
from tests.conftest import DEFAULT_CONFIG, AclientFactory
async def aclient_with_auth(aclient_factory: AclientFactory) -> AsyncGenerator[AsyncClient]:
"""Create a client wit... | 403 | assert | numeric_literal | tests/auth_test.py | test_protected_endpoint_requires_auth | 61 | null | |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | "ru" | assert | string_literal | tests/realtime_api_test.py | test_transcription_mode_with_language | TestRealtimeSessionConfiguration | 168 | null |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | 200 | assert | numeric_literal | tests/speech_test.py | test_speech_sse_stream_format | 358 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_srt_format_timestamp() -> None:
assert srt_format_timestamp(0.0) == | "00:00:00,000" | assert | string_literal | tests/text_utils_test.py | test_srt_format_timestamp | 14 | null | |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | "whisper-1" | assert | string_literal | tests/realtime_api_test.py | test_conversation_mode_with_custom_transcription | TestRealtimeSessionConfiguration | 151 | null |
speaches-ai/speaches | from collections.abc import AsyncGenerator
from httpx import AsyncClient
from pydantic import SecretStr
import pytest
import pytest_asyncio
from tests.conftest import DEFAULT_CONFIG, AclientFactory
async def aclient_with_auth(aclient_factory: AclientFactory) -> AsyncGenerator[AsyncClient]:
"""Create a client wit... | response.json() | assert | func_call | tests/auth_test.py | test_openapi_endpoint_public_with_auth_enabled | 54 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_m... | "No markdown here" | assert | string_literal | tests/text_utils_test.py | test_strip_markdown_emphasis | 45 | null | |
speaches-ai/speaches | import base64
from pathlib import Path
from typing import Self
from openai import AsyncOpenAI
from openai.types.chat import (
ChatCompletion,
ChatCompletionAudioParam,
ChatCompletionChunk,
)
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreat... | self.body.get("n", 1) | assert | func_call | tests/api_chat_test.py | check_num_choices_matches_n | AudioChatSessionArchive | 40 | null |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | session.modalities | assert | complex_expr | tests/realtime_api_test.py | test_session_structure_compatibility | TestRealtimeAPICompatibility | 298 | null |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
@pytest.mark.asyncio
async def test_eof_text_chunker_closed_error() -> None:
# Test that adding tokens to a closed chunker raises an error
chun... | RuntimeError) | pytest.raises | variable | tests/text_utils_test.py | test_eof_text_chunker_closed_error | 122 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | _OPUS_PREFERRED_SAMPLE_RATE | assert | variable | tests/speech_test.py | test_openai_speech_opus_sample_rate | 182 | null | |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | "af_heart" | assert | string_literal | tests/realtime_api_test.py | test_default_models_configuration | TestRealtimeAPICompatibility | 259 | null |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | caplog.text | assert | complex_expr | tests/realtime_api_test.py | test_session_configuration_logging | TestRealtimeSessionConfiguration | 186 | null |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_m... | "This is underlined" | assert | string_literal | tests/text_utils_test.py | test_strip_markdown_emphasis | 42 | null | |
speaches-ai/speaches | import base64
from pathlib import Path
from typing import Self
from openai import AsyncOpenAI
from openai.types.chat import (
ChatCompletion,
ChatCompletionAudioParam,
ChatCompletionChunk,
)
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreat... | "stop" | assert | string_literal | tests/api_chat_test.py | check_num_choices_matches_n | AudioChatSessionArchive | 43 | null |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | "gpt-4o-realtime-preview" | assert | string_literal | tests/realtime_api_test.py | test_conversation_mode_default | TestRealtimeSessionConfiguration | 139 | null |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_vtt_format_timestamp() -> None:
assert vtt_format_timestamp(0.0) == "00:00:00.000"
assert vtt_format_timestamp(1.0) == "00:00:01.000"
... | "00:01:01.000" | assert | string_literal | tests/text_utils_test.py | test_vtt_format_timestamp | 31 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_... | "I really like this" | assert | string_literal | tests/text_utils_test.py | test_strip_markdown_emphasis | 41 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | 0 | assert | numeric_literal | tests/speech_test.py | test_speech_sse_stream_format | 368 | null | |
speaches-ai/speaches | from pathlib import Path
import anyio
from httpx import AsyncClient
from httpx_sse import aconnect_sse
import pytest
import srt
import webvtt
import webvtt.vtt
MODEL_ID = "Systran/faster-whisper-tiny.en"
FILE_PATHS = ["audio.wav"] # HACK
ENDPOINTS = [
"/v1/audio/transcriptions",
]
parameters = [(file_path, endp... | response.headers["content-type"] | assert | complex_expr | tests/sse_test.py | test_transcription_srt | 71 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_srt_format_timestamp() -> None:
assert srt_format_timestamp(0.0) == "00:00:00,000"
assert srt_format_timestamp(1.0) == "00:00:01,000"
... | "00:01:01,000" | assert | string_literal | tests/text_utils_test.py | test_srt_format_timestamp | 18 | null | |
speaches-ai/speaches | from pathlib import Path
from httpx import AsyncClient
import numpy as np
import pytest
import soundfile as sf
EMBEDDING_MODEL_ID = "Wespeaker/wespeaker-voxceleb-resnet34-LM"
@pytest.mark.parametrize("pull_model_without_cleanup", [EMBEDDING_MODEL_ID], indirect=True)
@pytest.mark.usefixtures("pull_model_without_clean... | 0.99 | assert | numeric_literal | tests/speech_embedding_test.py | test_embedding_similarity | 130 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
@pytest.mark.asyncio
async def test_eof_text_chunker() -> None:
# Test that the chunker only yields when closed
chunker = EOFTextChunker()
... | 0 | assert | numeric_literal | tests/text_utils_test.py | test_eof_text_chunker | 75 | null | |
speaches-ai/speaches | import base64
from pathlib import Path
from typing import Self
from openai import AsyncOpenAI
from openai.types.chat import (
ChatCompletion,
ChatCompletionAudioParam,
ChatCompletionChunk,
)
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreat... | i | assert | variable | tests/api_chat_test.py | check_num_choices_matches_n | AudioChatSessionArchive | 42 | null |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == | "Hello my name is Jon" | assert | string_literal | tests/text_utils_test.py | test_strip_markdown_emphasis | 40 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | UnprocessableEntityError) | pytest.raises | variable | tests/speech_test.py | test_speech_invalid_resample | 148 | null | |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | "custom-model" | assert | string_literal | tests/realtime_api_test.py | test_websocket_parameter_parsing | TestRealtimeWebSocketEndpoint | 245 | null |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | WebSocketException) | pytest.raises | variable | tests/realtime_api_test.py | test_websocket_auth_invalid_key | TestRealtimeWebSocketAuthentication | 108 | null |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | "en" | assert | string_literal | tests/realtime_api_test.py | test_websocket_parameter_parsing | TestRealtimeWebSocketEndpoint | 246 | null |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
@pytest.mark.asyncio
async def test_eof_text_chunker() -> None:
# Test that the chunker only yields when closed
chunker = EOFTextChunker()
... | "Hello world!" | assert | string_literal | tests/text_utils_test.py | test_eof_text_chunker | 86 | null | |
speaches-ai/speaches | from pathlib import Path
import anyio
from httpx import AsyncClient
from httpx_sse import aconnect_sse
import pytest
import srt
import webvtt
import webvtt.vtt
MODEL_ID = "Systran/faster-whisper-tiny.en"
FILE_PATHS = ["audio.wav"] # HACK
ENDPOINTS = [
"/v1/audio/transcriptions",
]
parameters = [(file_path, endp... | 1 | assert | numeric_literal | tests/sse_test.py | test_streaming_transcription_text | 36 | null | |
speaches-ai/speaches | from collections.abc import AsyncGenerator
from httpx import AsyncClient
from pydantic import SecretStr
import pytest
import pytest_asyncio
from tests.conftest import DEFAULT_CONFIG, AclientFactory
async def aclient_with_auth(aclient_factory: AclientFactory) -> AsyncGenerator[AsyncClient]:
"""Create a client wit... | {"message": "OK"} | assert | collection | tests/auth_test.py | test_health_endpoint_public_without_auth | 31 | null | |
speaches-ai/speaches | from collections.abc import AsyncGenerator
from httpx import AsyncClient
from pydantic import SecretStr
import pytest
import pytest_asyncio
from tests.conftest import DEFAULT_CONFIG, AclientFactory
async def aclient_with_auth(aclient_factory: AclientFactory) -> AsyncGenerator[AsyncClient]:
"""Create a client wit... | 200 | assert | numeric_literal | tests/auth_test.py | test_health_endpoint_public_without_auth | 30 | null | |
speaches-ai/speaches | from pathlib import Path
from httpx import AsyncClient
import numpy as np
import pytest
import soundfile as sf
EMBEDDING_MODEL_ID = "Wespeaker/wespeaker-voxceleb-resnet34-LM"
@pytest.mark.parametrize("pull_model_without_cleanup", [EMBEDDING_MODEL_ID], indirect=True)
@pytest.mark.usefixtures("pull_model_without_clean... | 0 | assert | numeric_literal | tests/speech_embedding_test.py | test_create_speech_embedding | 36 | null | |
speaches-ai/speaches | import asyncio
import anyio
import pytest
from speaches.config import Config
from tests.conftest import AclientFactory
MODEL_ID = "Systran/faster-whisper-tiny.en"
@pytest.mark.parametrize("pull_model_without_cleanup", [MODEL_ID], indirect=True)
@pytest.mark.usefixtures("pull_model_without_cleanup")
@pytest.mark.asy... | 201 | assert | numeric_literal | tests/model_manager_test.py | test_model_cant_be_loaded_twice | 106 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | 0.5 | assert | numeric_literal | tests/speech_test.py | test_speaches_speech_chunk_transfer_encoding | 339 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_vtt_format_timestamp() -> None:
assert vtt_format_timestamp(0.0) == "00:00:00.000"
assert vtt_format_timestamp(1.0) == "00:00:01.000"
... | "00:01:00.000" | assert | string_literal | tests/text_utils_test.py | test_vtt_format_timestamp | 30 | null | |
speaches-ai/speaches | import asyncio
import anyio
import pytest
from speaches.config import Config
from tests.conftest import AclientFactory
MODEL_ID = "Systran/faster-whisper-tiny.en"
@pytest.mark.parametrize("pull_model_without_cleanup", [MODEL_ID], indirect=True)
@pytest.mark.usefixtures("pull_model_without_cleanup")
@pytest.mark.asy... | 0 | assert | numeric_literal | tests/model_manager_test.py | test_model_unloaded_after_ttl | 20 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
@pytest.mark.asyncio
async def test_eof_text_chunker() -> None:
# Test that the chunker only yields when closed
chunker = EOFTextChunker()
... | 1 | assert | numeric_literal | tests/text_utils_test.py | test_eof_text_chunker | 85 | null | |
speaches-ai/speaches | from collections.abc import AsyncGenerator
from httpx import AsyncClient
from pydantic import SecretStr
import pytest
import pytest_asyncio
from tests.conftest import DEFAULT_CONFIG, AclientFactory
async def aclient_with_auth(aclient_factory: AclientFactory) -> AsyncGenerator[AsyncClient]:
"""Create a client wit... | "Bearer" | assert | string_literal | tests/auth_test.py | test_www_authenticate_header_present | 135 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | "audio/pcm" | assert | string_literal | tests/speech_test.py | test_speech_default_stream_format_is_audio | 404 | null | |
speaches-ai/speaches | import base64
from pathlib import Path
from typing import Self
from openai import AsyncOpenAI
from openai.types.chat import (
ChatCompletion,
ChatCompletionAudioParam,
ChatCompletionChunk,
)
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreat... | None | assert | none_literal | tests/api_chat_test.py | correct_attributes_based_on_modality | AudioChatSessionArchive | 49 | null |
speaches-ai/speaches | from pathlib import Path
from httpx import AsyncClient
import numpy as np
import pytest
import soundfile as sf
EMBEDDING_MODEL_ID = "Wespeaker/wespeaker-voxceleb-resnet34-LM"
@pytest.mark.parametrize("pull_model_without_cleanup", [EMBEDDING_MODEL_ID], indirect=True)
@pytest.mark.usefixtures("pull_model_without_clean... | 200 | assert | numeric_literal | tests/speech_embedding_test.py | test_create_speech_embedding | 29 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_srt_format_timestamp() -> None:
assert srt_format_timestamp(0.0) == "00:00:00,000"
assert srt_format_timestamp(1.0) == "00:00:01,000"
... | "00:00:01,234" | assert | string_literal | tests/text_utils_test.py | test_srt_format_timestamp | 16 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_m... | "This is italic" | assert | string_literal | tests/text_utils_test.py | test_strip_markdown_emphasis | 43 | null | |
speaches-ai/speaches | import base64
from pathlib import Path
from typing import Self
from openai import AsyncOpenAI
from openai.types.chat import (
ChatCompletion,
ChatCompletionAudioParam,
ChatCompletionChunk,
)
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreat... | 1 | assert | numeric_literal | tests/api_chat_test.py | check_all_chat_completion_ids_are_the_same | AudioChatStreamingSessionArchive | 71 | null |
speaches-ai/speaches | from unittest.mock import MagicMock
from fastapi.testclient import TestClient
from pydantic import SecretStr
import pytest
from pytest_mock import MockerFixture
from speaches.config import Config, WhisperConfig
from speaches.main import create_app
from speaches.realtime.session import create_session_object_configurat... | None | assert | none_literal | tests/realtime_api_test.py | test_conversation_mode_default | TestRealtimeSessionConfiguration | 142 | null |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_vtt_format_timestamp() -> None:
assert vtt_format_timestamp(0.0) == "00:00:00.000"
assert vtt_format_timestamp(1.0) == "00:00:01.000"
... | "00:00:01.234" | assert | string_literal | tests/text_utils_test.py | test_vtt_format_timestamp | 29 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | 1 | assert | numeric_literal | tests/speech_test.py | test_speech_sse_stream_format | 374 | null | |
speaches-ai/speaches | from pathlib import Path
from httpx import AsyncClient
import numpy as np
import pytest
import soundfile as sf
EMBEDDING_MODEL_ID = "Wespeaker/wespeaker-voxceleb-resnet34-LM"
@pytest.mark.asyncio
async def test_create_speech_embedding_model_not_found(aclient: AsyncClient, tmp_path: Path) -> None:
sample_rate = 1... | 404 | assert | numeric_literal | tests/speech_embedding_test.py | test_create_speech_embedding_model_not_found | 88 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_vtt_format_timestamp() -> None:
assert vtt_format_timestamp(0.0) == | "00:00:00.000" | assert | string_literal | tests/text_utils_test.py | test_vtt_format_timestamp | 27 | null | |
speaches-ai/speaches | from pathlib import Path
import anyio
from httpx import AsyncClient
import pytest
from speaches.routers.vad import MODEL_ID, SpeechTimestamp
FILE_PATH = "audio.wav"
ENDPOINT = "/v1/audio/speech/timestamps"
@pytest.mark.asyncio
async def test_speech_timestamps_basic(aclient: AsyncClient) -> None:
extension = Pat... | 1 | assert | numeric_literal | tests/vad_test.py | test_speech_timestamps_basic | 24 | null | |
speaches-ai/speaches | import base64
import io
import json
import time
from httpx import AsyncClient
from openai import AsyncOpenAI, UnprocessableEntityError
import openai.types.audio
import pydub
import pytest
import soundfile as sf
from speaches.api_types import (
DEFAULT_SPEECH_RESPONSE_FORMAT,
SUPPORTED_SPEECH_RESPONSE_FORMATS,... | previous_size | assert | variable | tests/speech_test.py | test_create_speech_with_varying_speed | 99 | null | |
speaches-ai/speaches | from pathlib import Path
from httpx import AsyncClient
import numpy as np
import pytest
import soundfile as sf
EMBEDDING_MODEL_ID = "Wespeaker/wespeaker-voxceleb-resnet34-LM"
@pytest.mark.parametrize("pull_model_without_cleanup", [EMBEDDING_MODEL_ID], indirect=True)
@pytest.mark.usefixtures("pull_model_without_clean... | 256 | assert | numeric_literal | tests/speech_embedding_test.py | test_create_speech_embedding | 38 | null | |
speaches-ai/speaches | from pathlib import Path
from openai import AsyncOpenAI, BadRequestError
import pytest
from speaches.api_types import TIMESTAMP_GRANULARITIES_COMBINATIONS, TimestampGranularities
@pytest.mark.asyncio
@pytest.mark.requires_openai
@pytest.mark.parametrize("timestamp_granularities", TIMESTAMP_GRANULARITIES_COMBINATIONS... | BadRequestError) | pytest.raises | variable | tests/openai_timestamp_granularities_test.py | test_openai_json_response_format_and_timestamp_granularities_combinations | 20 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.