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 |
|---|---|---|---|---|---|---|---|---|---|
dynaconf/dynaconf | from __future__ import annotations
from dynaconf import settings
def test_has_wrapped():
assert settings.configured is | True | assert | bool_literal | tests/test_basic.py | test_has_wrapped | 7 | null | |
dynaconf/dynaconf | from __future__ import annotations
import os
from types import MappingProxyType
import pytest
from dynaconf import Dynaconf
from dynaconf import LazySettings
from dynaconf import ValidationError
from dynaconf import Validator
from dynaconf.validator import ValidatorList
TOML = """
[default]
EXAMPLE = true
MYSQL_HOS... | 1 | assert | numeric_literal | tests/test_validators.py | test_no_reload_on_single_env | 269 | null | |
dynaconf/dynaconf | import asyncio
import pytest
from dynaconf import Dynaconf
@pytest.mark.asyncio
async def test_contextvars_async_isolation():
"""Test that evaluation stacks are isolated in async contexts."""
async def task1():
settings = Dynaconf()
settings.set("VALUE", "@format Task1-{this.ID}")
se... | "Task1-1" | assert | string_literal | tests/test_async_safety.py | test_contextvars_async_isolation | 52 | null | |
dynaconf/dynaconf | import os
import sys
from typing import Annotated
from typing import Optional
from typing import Union
import pytest
from dynaconf.typed import DictValue
from dynaconf.typed import Dynaconf
from dynaconf.typed import DynaconfSchemaError
from dynaconf.typed import ItemsValidator
from dynaconf.typed import NotRequired
... | "Erik" | assert | string_literal | tests/test_typed.py | test_dynaconf_options | 436 | null | |
dynaconf/dynaconf | from __future__ import annotations
import os
import sys
from collections import OrderedDict
from os import environ
import pytest
from dynaconf import settings # noqa
from dynaconf.loaders.env_loader import load
from dynaconf.loaders.env_loader import load_from_env
from dynaconf.loaders.env_loader import write
envi... | -1 | assert | numeric_literal | tests/test_env_loader.py | test_load_signed_integer | 219 | null | |
dynaconf/dynaconf | from __future__ import annotations
import os
from types import MappingProxyType
import pytest
from dynaconf import Dynaconf
from dynaconf import LazySettings
from dynaconf import ValidationError
from dynaconf import Validator
from dynaconf.validator import ValidatorList
TOML = """
[default]
EXAMPLE = true
MYSQL_HOS... | TypeError) | pytest.raises | variable | tests/test_validators.py | test_validators_register | 198 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, Identification, Post, TranscriptSegment
from podcast_processor.audio_processor import AudioProcessor
from shared.config import Config
from shared.test_utils import... | 1 | assert | numeric_literal | src/tests/test_audio_processor.py | test_merge_ad_segments_with_short_segments | 124 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Any
from shared.config import Config
class TestRateLimitingConfig:
def test_custom_rate_limiting_config(self) -> None:
"""Test that custom rate limiting values are properly set."""
config_data: dict[str, Any] = {
"llm_api_key": "test-key",
"llm_max_concu... | 10 | assert | numeric_literal | src/tests/test_rate_limiting_config.py | test_custom_rate_limiting_config | TestRateLimitingConfig | 61 | null |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
import pytest
from podcast_processor.llm_concurrency_limiter import (
ConcurrencyContext,
LLMConcurrencyLimiter,
get_concurrency_limiter,
)
class TestLLMConcurrencyLimiter:
def test_thread_safety(self):
"""Test that the limiter works correctly with multiple threa... | 8 | assert | numeric_literal | src/tests/test_llm_concurrency_limiter.py | test_thread_safety | TestLLMConcurrencyLimiter | 140 | null |
podly-pure-podcasts/podly_pure_podcasts | from typing import Any
from shared.config import Config
class TestRateLimitingConfig:
def test_default_rate_limiting_config(self) -> None:
"""Test that rate limiting defaults are properly set."""
config_data: dict[str, Any] = {
"llm_api_key": "test-key",
"output": {
... | 3 | assert | numeric_literal | src/tests/test_rate_limiting_config.py | test_default_rate_limiting_config | TestRateLimitingConfig | 31 | null |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import pytest
from flask import Flask, Response, g, jsonify
from app.auth import AuthSettings
from app.auth.middleware import init_auth_middleware
from app.auth.state import failure_rate_limiter
from app.extensions import db
from app.mode... | secret | assert | variable | src/tests/test_session_auth.py | test_share_link_generates_token_and_allows_query_access | 158 | null | |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from typing import Literal, Optional
from pydantic import BaseModel, Field, model_validator
from shared import defaults as DEFAULTS
class ProcessingConfig(BaseModel):
num_segments_to_input_to_prompt: int
max_overlap_segments: int = Field(
default=DEFAULTS.PROCESSIN... | self.num_segments_to_input_to_prompt | assert | complex_expr | src/shared/config.py | validate_overlap_limits | ProcessingConfig | 20 | null |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from datetime import datetime, timedelta
from pathlib import Path
from app.extensions import db
from app.models import (
Feed,
Identification,
ModelCall,
Post,
ProcessingJob,
TranscriptSegment,
)
from app.post_cleanup import cleanup_processed_posts, count_cle... | None | assert | none_literal | src/tests/test_post_cleanup.py | test_cleanup_removes_expired_posts | 128 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | existing_call.id | assert | complex_expr | src/tests/test_transcription_manager.py | test_transcribe_reuses_placeholder_model_call | 292 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, Identification, Post, TranscriptSegment
from podcast_processor.audio_processor import AudioProcessor
from shared.config import Config
from shared.test_utils import... | (0.0, 10.0) | assert | collection | src/tests/test_audio_processor.py | test_get_ad_segments | 79 | null | |
podly-pure-podcasts/podly_pure_podcasts | import time
from typing import Any
from unittest.mock import patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestRateLimitingEdgeCases:
def test_token_counting_edge_cases(self) -> ... | 10000 | assert | numeric_literal | src/tests/test_rate_limiting_edge_cases.py | test_token_counting_edge_cases | TestRateLimitingEdgeCases | 36 | null |
podly-pure-podcasts/podly_pure_podcasts | import tempfile
from pathlib import Path
from podcast_processor.audio import (
clip_segments_with_fade,
get_audio_duration_ms,
split_audio,
)
TEST_FILE_DURATION = 66_048
TEST_FILE_PATH = "src/tests/data/count_0_99.mp3"
def test_get_duration_ms() -> None:
assert get_audio_duration_ms(TEST_FILE_PATH) ... | TEST_FILE_DURATION | assert | variable | src/tests/test_process_audio.py | test_get_duration_ms | 15 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | "failed_permanent" | assert | string_literal | src/tests/test_transcription_manager.py | test_transcribe_handles_error | 242 | null | |
podly-pure-podcasts/podly_pure_podcasts | import datetime
from types import SimpleNamespace
from unittest import mock
from flask import g
from app.extensions import db
from app.models import Feed, Post, User
from app.routes.post_routes import post_bp
from app.runtime_config import config as runtime_config
def test_toggle_whitelist_all_requires_admin(app):
... | 200 | assert | numeric_literal | src/tests/test_post_routes.py | test_toggle_whitelist_all_requires_admin | 263 | null | |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_get_current_usage(self) -> None:
"""Test getting current token usage wit... | 500 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_get_current_usage | TestTokenRateLimiter | 93 | null |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | "Test Episode.mp3" | assert | string_literal | src/tests/test_podcast_downloader.py | test_get_and_make_download_path | 76 | null | |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from podcast_processor.llm_error_classifier import LLMErrorClassifier
class TestLLMErrorClassifier:
def test_server_errors(self):
"""Test identification of server errors."""
server_errors = [
"Internal server error",
"HTTP 500 error",
"HTTP 502 Ba... | "server_error" | assert | string_literal | src/tests/test_llm_error_classifier.py | test_server_errors | TestLLMErrorClassifier | 51 | null |
podly-pure-podcasts/podly_pure_podcasts | from typing import Any
from shared.config import Config
class TestRateLimitingConfig:
def test_config_field_descriptions(self) -> None:
"""Test that config fields have proper descriptions."""
# Test that the field definitions include helpful descriptions
config_fields = Config.model_field... | config_fields | assert | variable | src/tests/test_rate_limiting_config.py | test_config_field_descriptions | TestRateLimitingConfig | 98 | null |
podly-pure-podcasts/podly_pure_podcasts | from pathlib import Path
from unittest.mock import patch
from app.models import Post
from app.posts import remove_associated_files
class TestPostsFunctions:
@patch("app.posts._remove_file_if_exists")
@patch("app.posts._dedupe_and_find_existing")
@patch("app.posts._collect_processed_paths")
@patch("ap... | 1 | assert | numeric_literal | src/tests/test_posts.py | test_remove_associated_files_files_dont_exist | TestPostsFunctions | 42 | null |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from pydantic import ValidationError
from podcast_processor.model_output import (
AdSegmentPrediction,
AdSegmentPredictionList,
clean_and_parse_model_output,
)
def test_clean_parse_output_malformed() -> None:
model_outupt = """
{"ad_segments": uhoh1.7, 1114.8, 1116.4, 1118.2, 1119.5, 112... | ValidationError) | pytest.raises | variable | src/tests/test_parse_model_output.py | test_clean_parse_output_malformed | 47 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Generator
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from jinja2 import Template
from litellm.exceptions import InternalServerError
from litellm.types.utils import Choices
from app.extensions import db
from app.models import ModelCall, Post, TranscriptSegment
f... | "success" | assert | string_literal | src/tests/test_ad_classifier.py | test_call_model | 111 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest.mock import Mock, patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestAdClassifierRateLimiting:
@patch("podcast_processor.ad_classifier.litellm")
@patch("podcast_... | "anthropic/claude-3-5-sonnet-20240620" | assert | string_literal | src/tests/test_ad_classifier_rate_limiting_integration.py | test_call_model_with_rate_limiter | TestAdClassifierRateLimiting | 134 | null |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_check_rate_limit_within_limits(self) -> None:
"""Test rate limit check w... | 0.0 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_check_rate_limit_within_limits | TestTokenRateLimiter | 103 | null |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
import pytest
from podcast_processor.llm_concurrency_limiter import (
ConcurrencyContext,
LLMConcurrencyLimiter,
get_concurrency_limiter,
)
class TestLLMConcurrencyLimiter:
def test_initialization(self):
"""Test proper initialization of the concurrency limiter.""... | 0 | assert | numeric_literal | src/tests/test_llm_concurrency_limiter.py | test_initialization | TestLLMConcurrencyLimiter | 25 | null |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_initialization(self) -> None:
"""Test rate limiter initialization with d... | 120 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_initialization | TestTokenRateLimiter | 30 | null |
podly-pure-podcasts/podly_pure_podcasts | import datetime
from types import SimpleNamespace
from unittest import mock
from flask import g
from app.extensions import db
from app.models import Feed, Post, User
from app.routes.post_routes import post_bp
from app.runtime_config import config as runtime_config
def test_toggle_whitelist_all_requires_admin(app):
... | 403 | assert | numeric_literal | src/tests/test_post_routes.py | test_toggle_whitelist_all_requires_admin | 258 | null | |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from pydantic import ValidationError
from podcast_processor.model_output import (
AdSegmentPrediction,
AdSegmentPredictionList,
clean_and_parse_model_output,
)
def test_clean_parse_output_truncated_multiple_segments() -> None:
"""Test parsing truncated JSON with multiple complete segment... | AdSegmentPredictionList( ad_segments=[ AdSegmentPrediction(segment_offset=10.5, confidence=0.92), AdSegmentPrediction(segment_offset=25.0, confidence=0.85), ] ) | assert | func_call | src/tests/test_parse_model_output.py | test_clean_parse_output_truncated_multiple_segments | 76 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, Identification, Post, TranscriptSegment
from podcast_processor.audio_processor import AudioProcessor
from shared.config import Config
from shared.test_utils import... | (28000, 30000) | assert | collection | src/tests/test_audio_processor.py | test_merge_ad_segments_end_extension | 145 | null | |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import pytest
from flask import Flask, Response, g, jsonify
from app.auth import AuthSettings
from app.auth.middleware import init_auth_middleware
from app.auth.state import failure_rate_limiter
from app.extensions import db
from app.mode... | second["feed_secret"] | assert | complex_expr | src/tests/test_session_auth.py | test_share_link_returns_same_token_for_user_and_feed | 191 | null | |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_initialization(self) -> None:
"""Test rate limiter initialization with d... | 60 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_initialization | TestTokenRateLimiter | 24 | null |
podly-pure-podcasts/podly_pure_podcasts | from shared.test_utils import create_standard_test_config
def test_config_validation() -> None:
"""Test that the config validation works with the new setting."""
# Test with token limit
config_with_limit = create_standard_test_config(llm_max_input_tokens_per_call=50000)
assert config_with_limit.llm_ma... | None | assert | none_literal | src/tests/test_token_limit_config.py | test_config_validation | 19 | null | |
podly-pure-podcasts/podly_pure_podcasts | import datetime
from types import SimpleNamespace
from unittest import mock
from flask import g
from app.extensions import db
from app.models import Feed, Post, User
from app.routes.post_routes import post_bp
from app.runtime_config import config as runtime_config
def test_feed_posts_pagination_and_filtering(app):
... | 5 | assert | numeric_literal | src/tests/test_post_routes.py | test_feed_posts_pagination_and_filtering | 318 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Generator
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from jinja2 import Template
from litellm.exceptions import InternalServerError
from litellm.types.utils import Choices
from app.extensions import db
from app.models import ModelCall, Post, TranscriptSegment
f... | True | assert | bool_literal | src/tests/test_ad_classifier.py | test_build_chunk_payload_trims_for_token_limit | 410 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, Identification, Post, TranscriptSegment
from podcast_processor.audio_processor import AudioProcessor
from shared.config import Config
from shared.test_utils import... | output_path | assert | variable | src/tests/test_audio_processor.py | test_process_audio | 190 | null | |
podly-pure-podcasts/podly_pure_podcasts | import datetime
import logging
import uuid
from types import SimpleNamespace
from unittest import mock
import feedparser
import PyRSS2Gen
import pytest
from app.feeds import (
_get_base_url,
_should_auto_whitelist_new_posts,
add_feed,
db,
feed_item,
fetch_feed,
generate_feed_xml,
get_d... | entry) | assert_* | variable | src/tests/test_feeds.py | test_get_guid_generates_uuid_if_invalid_id | 781 | null | |
podly-pure-podcasts/podly_pure_podcasts | import time
from typing import Any
from unittest.mock import patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestRateLimitingEdgeCases:
def test_error_classification_comprehensive(... | False | assert | bool_literal | src/tests/test_rate_limiting_edge_cases.py | test_error_classification_comprehensive | TestRateLimitingEdgeCases | 131 | null |
podly-pure-podcasts/podly_pure_podcasts | import time
from typing import Any
from unittest.mock import patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestRateLimitingEdgeCases:
def test_rate_limiter_with_very_short_window... | 20 | assert | numeric_literal | src/tests/test_rate_limiting_edge_cases.py | test_rate_limiter_with_very_short_window | TestRateLimitingEdgeCases | 218 | null |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from podcast_processor.llm_error_classifier import LLMErrorClassifier
class TestLLMErrorClassifier:
def test_suggested_backoff(self):
"""Test suggested backoff times for different error types."""
# Rate limit errors should have longer backoff
rate_limit_backoff = LLMErrorCla... | backoff_attempt_1 | assert | variable | src/tests/test_llm_error_classifier.py | test_suggested_backoff | TestLLMErrorClassifier | 124 | null |
podly-pure-podcasts/podly_pure_podcasts | import datetime
import logging
import uuid
from types import SimpleNamespace
from unittest import mock
import feedparser
import PyRSS2Gen
import pytest
from app.feeds import (
_get_base_url,
_should_auto_whitelist_new_posts,
add_feed,
db,
feed_item,
fetch_feed,
generate_feed_xml,
get_d... | "utf-8") | assert_* | string_literal | src/tests/test_feeds.py | test_generate_feed_xml_filters_processed_whitelisted | 628 | null | |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import pytest
from flask import Flask, Response, g, jsonify
from app.auth import AuthSettings
from app.auth.middleware import init_auth_middleware
from app.auth.state import failure_rate_limiter
from app.extensions import db
from app.mode... | 204 | assert | numeric_literal | src/tests/test_session_auth.py | test_logout_clears_session | 105 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Any
from unittest.mock import MagicMock
import pytest
from openai.types.audio.transcription_segment import TranscriptionSegment
@pytest.mark.skip
def test_groq_transcribe(mocker: Any) -> None:
# import here instead of the toplevel because dependencies aren't installed properly in... | "This is a test segment." | assert | string_literal | src/tests/test_transcribe.py | test_groq_transcribe | 78 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | None | assert | none_literal | src/tests/test_podcast_downloader.py | test_download_episode_download_failed | 160 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Any
from shared.config import Config
class TestRateLimitingConfig:
def test_default_rate_limiting_config(self) -> None:
"""Test that rate limiting defaults are properly set."""
config_data: dict[str, Any] = {
"llm_api_key": "test-key",
"output": {
... | False | assert | bool_literal | src/tests/test_rate_limiting_config.py | test_default_rate_limiting_config | TestRateLimitingConfig | 34 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | 1 | assert | numeric_literal | src/tests/test_transcription_manager.py | test_transcribe_new | 199 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Generator
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from jinja2 import Template
from litellm.exceptions import InternalServerError
from litellm.types.utils import Choices
from app.extensions import db
from app.models import ModelCall, Post, TranscriptSegment
f... | 2 | assert | numeric_literal | src/tests/test_ad_classifier.py | test_build_chunk_payload_trims_for_token_limit | 411 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | 2 | assert | numeric_literal | src/tests/test_transcription_manager.py | test_check_existing_transcription_success | 142 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Any
from unittest.mock import MagicMock
import pytest
from openai.types.audio.transcription_segment import TranscriptionSegment
@pytest.mark.skip
def test_remote_transcribe() -> None:
# import here instead of the toplevel because torch is not installed properly in CI.
from po... | [] | assert | collection | src/tests/test_transcribe.py | test_remote_transcribe | 26 | null | |
podly-pure-podcasts/podly_pure_podcasts | import unittest
from podcast_processor.cue_detector import CueDetector
from podcast_processor.prompt import transcript_excerpt_for_prompt
from podcast_processor.transcribe import Segment
class TestCueDetector(unittest.TestCase):
def setUp(self) -> None:
self.detector = CueDetector()
def test_integrat... | result) | self.assertIn | variable | tests/test_cue_detector.py | test_integration_prompt | TestCueDetector | 62 | null |
podly-pure-podcasts/podly_pure_podcasts | from unittest.mock import Mock, patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestAdClassifierRateLimiting:
def test_rate_limiter_initialization_enabled(self):
"""Test th... | None | assert | none_literal | src/tests/test_ad_classifier_rate_limiting_integration.py | test_rate_limiter_initialization_enabled | TestAdClassifierRateLimiting | 23 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Any
from unittest.mock import MagicMock
import pytest
from openai.types.audio.transcription_segment import TranscriptionSegment
@pytest.mark.skip
def test_groq_transcribe(mocker: Any) -> None:
# import here instead of the toplevel because dependencies aren't installed properly in... | "This is another test segment." | assert | string_literal | src/tests/test_transcribe.py | test_groq_transcribe | 79 | null | |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_thread_safety(self) -> None:
"""Test that the rate limiter is thread-saf... | 50 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_thread_safety | TestTokenRateLimiter | 223 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, Identification, Post, TranscriptSegment
from podcast_processor.audio_processor import AudioProcessor
from shared.config import Config
from shared.test_utils import... | None | assert | none_literal | src/tests/test_audio_processor.py | test_process_audio | 188 | null | |
podly-pure-podcasts/podly_pure_podcasts | import unittest
from podcast_processor.cue_detector import CueDetector
from podcast_processor.prompt import transcript_excerpt_for_prompt
from podcast_processor.transcribe import Segment
class TestCueDetector(unittest.TestCase):
def setUp(self) -> None:
self.detector = CueDetector()
def test_highligh... | text) | self.assertEqual | variable | tests/test_cue_detector.py | test_highlight_cues_no_cues | TestCueDetector | 46 | null |
podly-pure-podcasts/podly_pure_podcasts | import time
from typing import Any
from unittest.mock import patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestRateLimitingEdgeCases:
def test_token_counting_edge_cases(self) -> ... | 0 | assert | numeric_literal | src/tests/test_rate_limiting_edge_cases.py | test_token_counting_edge_cases | TestRateLimitingEdgeCases | 25 | null |
podly-pure-podcasts/podly_pure_podcasts | import datetime
from types import SimpleNamespace
from unittest import mock
from flask import g
from app.extensions import db
from app.models import Feed, Post, User
from app.routes.post_routes import post_bp
from app.runtime_config import config as runtime_config
def test_download_triggers_processing_when_enabled(a... | "started" | assert | string_literal | src/tests/test_post_routes.py | test_download_triggers_processing_when_enabled | 100 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | None | assert | none_literal | src/tests/test_transcription_manager.py | test_check_existing_transcription_success | 141 | null | |
podly-pure-podcasts/podly_pure_podcasts | from shared.test_utils import create_standard_test_config
def test_config_validation() -> None:
"""Test that the config validation works with the new setting."""
# Test with token limit
config_with_limit = create_standard_test_config(llm_max_input_tokens_per_call=50000)
assert config_with_limit.llm_m... | 50000 | assert | numeric_literal | src/tests/test_token_limit_config.py | test_config_validation | 13 | null | |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from pydantic import ValidationError
from podcast_processor.model_output import (
AdSegmentPrediction,
AdSegmentPredictionList,
clean_and_parse_model_output,
)
def test_parse_multiple_segments_output() -> None:
model_outupt = """
{"ad_segments": [
{"segment_offset": 123.45, "confiden... | AdSegmentPredictionList( ad_segments=[ AdSegmentPrediction(segment_offset=123.45, confidence=0.7), AdSegmentPrediction(segment_offset=23.45, confidence=0.8), AdSegmentPrediction(segment_offset=45.67, confidence=0.9), ] ) | assert | func_call | src/tests/test_parse_model_output.py | test_parse_multiple_segments_output | 34 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest.mock import Mock, patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestAdClassifierRateLimiting:
@patch("time.sleep")
def test_rate_limit_backoff_timing(self, mock... | 60) | assert_* | numeric_literal | src/tests/test_ad_classifier_rate_limiting_integration.py | test_rate_limit_backoff_timing | TestAdClassifierRateLimiting | 160 | null |
podly-pure-podcasts/podly_pure_podcasts | import importlib
from typing import Any
import pytest
from shared.config import Config, OutputConfig, ProcessingConfig
app_module = importlib.import_module("app.__init__")
class TestEnvKeyValidation:
def test_llm_and_groq_conflict_raises(self, monkeypatch: Any) -> None:
monkeypatch.setenv("LLM_API_KEY"... | SystemExit) | pytest.raises | variable | src/tests/test_config_error_handling.py | test_llm_and_groq_conflict_raises | TestEnvKeyValidation | 125 | null |
podly-pure-podcasts/podly_pure_podcasts | import importlib
from typing import Any
import pytest
from shared.config import Config, OutputConfig, ProcessingConfig
app_module = importlib.import_module("app.__init__")
class TestConfigurationErrorHandling:
def test_very_large_values(self) -> None:
"""Test configuration with very large values."""
... | 999999 | assert | numeric_literal | src/tests/test_config_error_handling.py | test_very_large_values | TestConfigurationErrorHandling | 78 | null |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from podcast_processor.llm_error_classifier import LLMErrorClassifier
class TestLLMErrorClassifier:
def test_auth_vs_client_errors(self):
"""Test distinction between auth errors and other client errors."""
auth_errors = [
"Authentication failed",
"Authorizati... | "auth_error" | assert | string_literal | src/tests/test_llm_error_classifier.py | test_auth_vs_client_errors | TestLLMErrorClassifier | 79 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | "Segment 1" | assert | string_literal | src/tests/test_transcription_manager.py | test_check_existing_transcription_success | 143 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest.mock import Mock, patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestAdClassifierRateLimiting:
def test_rate_limiter_initialization_enabled(self):
"""Test th... | 30000 | assert | numeric_literal | src/tests/test_ad_classifier_rate_limiting_integration.py | test_rate_limiter_initialization_enabled | TestAdClassifierRateLimiting | 25 | null |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_cleanup_old_usage(self) -> None:
"""Test cleanup of old token usage reco... | 2 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_cleanup_old_usage | TestTokenRateLimiter | 77 | null |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from podcast_processor.llm_error_classifier import LLMErrorClassifier
class TestLLMErrorClassifier:
def test_non_retryable_errors(self):
"""Test identification of non-retryable errors."""
non_retryable_errors = [
"Authentication failed",
"Invalid API key",
... | ["auth_error", "client_error"] | assert | collection | src/tests/test_llm_error_classifier.py | test_non_retryable_errors | TestLLMErrorClassifier | 67 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Any
from unittest.mock import MagicMock
import pytest
from openai.types.audio.transcription_segment import TranscriptionSegment
@pytest.mark.skip
def test_groq_transcribe(mocker: Any) -> None:
# import here instead of the toplevel because dependencies aren't installed properly in... | 2 | assert | numeric_literal | src/tests/test_transcribe.py | test_groq_transcribe | 77 | null | |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
import pytest
from podcast_processor.llm_concurrency_limiter import (
ConcurrencyContext,
LLMConcurrencyLimiter,
get_concurrency_limiter,
)
class TestGlobalConcurrencyLimiter:
def test_get_concurrency_limiter_different_limits(self):
"""Test that get_concurrency_l... | 5 | assert | numeric_literal | src/tests/test_llm_concurrency_limiter.py | test_get_concurrency_limiter_different_limits | TestGlobalConcurrencyLimiter | 177 | null |
podly-pure-podcasts/podly_pure_podcasts | import datetime
from types import SimpleNamespace
from unittest import mock
from flask import g
from app.extensions import db
from app.models import Feed, Post, User
from app.routes.post_routes import post_bp
from app.runtime_config import config as runtime_config
def test_feed_posts_pagination_and_filtering(app):
... | 25 | assert | numeric_literal | src/tests/test_post_routes.py | test_feed_posts_pagination_and_filtering | 304 | null | |
podly-pure-podcasts/podly_pure_podcasts | import tempfile
from pathlib import Path
from podcast_processor.audio import (
clip_segments_with_fade,
get_audio_duration_ms,
split_audio,
)
TEST_FILE_DURATION = 66_048
TEST_FILE_PATH = "src/tests/data/count_0_99.mp3"
def test_clip_segment_with_fade() -> None:
fade_len_ms = 5_000
ad_start_offset... | 60 | assert | numeric_literal | src/tests/test_process_audio.py | test_clip_segment_with_fade | 38 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest.mock import Mock, patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestAdClassifierRateLimiting:
def test_rate_limiter_model_specific_configs(self):
"""Test th... | expected_limit | assert | variable | src/tests/test_ad_classifier_rate_limiting_integration.py | test_rate_limiter_model_specific_configs | TestAdClassifierRateLimiting | 185 | null |
podly-pure-podcasts/podly_pure_podcasts | import importlib
from typing import Any
import pytest
from shared.config import Config, OutputConfig, ProcessingConfig
app_module = importlib.import_module("app.__init__")
class TestConfigurationErrorHandling:
def test_boolean_field_validation(self) -> None:
"""Test boolean field validation."""
... | True | assert | bool_literal | src/tests/test_config_error_handling.py | test_boolean_field_validation | TestConfigurationErrorHandling | 99 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | "Transcription failed" | assert | string_literal | src/tests/test_transcription_manager.py | test_transcribe_handles_error | 235 | null | |
podly-pure-podcasts/podly_pure_podcasts | import datetime
import logging
import uuid
from types import SimpleNamespace
from unittest import mock
import feedparser
import PyRSS2Gen
import pytest
from app.feeds import (
_get_base_url,
_should_auto_whitelist_new_posts,
add_feed,
db,
feed_item,
fetch_feed,
generate_feed_xml,
get_d... | True | assert | bool_literal | src/tests/test_feeds.py | test_should_auto_whitelist_new_posts_true_with_members | 203 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | b"podcast audio content" | assert | string_literal | src/tests/test_podcast_downloader.py | test_download_episode_new_file | 131 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Any
from unittest.mock import MagicMock
import pytest
from openai.types.audio.transcription_segment import TranscriptionSegment
def test_offset() -> None:
# import here instead of the toplevel because torch is not installed properly in CI.
from podcast_processor.transcribe im... | [ TranscriptionSegment( id=1, avg_logprob=2, seek=6, temperature=7, text="hi", tokens=[], compression_ratio=3, no_speech_prob=4, start=12.468, end=45.800999999999995, ) ] | assert | collection | src/tests/test_transcribe.py | test_offset | 88 | null | |
podly-pure-podcasts/podly_pure_podcasts | import logging
from typing import Generator
from unittest.mock import MagicMock
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, ModelCall, Post, TranscriptSegment
from podcast_processor.transcribe import Segment, Transcriber
from podcast_processor.transcription_manager... | "Segment 2" | assert | string_literal | src/tests/test_transcription_manager.py | test_check_existing_transcription_success | 144 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest.mock import Mock, patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestAdClassifierRateLimiting:
@patch("podcast_processor.ad_classifier.litellm")
@patch("podcast_... | "system" | assert | string_literal | src/tests/test_ad_classifier_rate_limiting_integration.py | test_call_model_with_rate_limiter | TestAdClassifierRateLimiting | 136 | null |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | str(expected_path) | assert | func_call | src/tests/test_podcast_downloader.py | test_download_episode_new_file | 134 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | "https://example.com/podcast.mp3") | assert_* | string_literal | src/tests/test_podcast_downloader.py | test_download_episode_new_file | 124 | null | |
podly-pure-podcasts/podly_pure_podcasts | import importlib
from typing import Any
import pytest
from shared.config import Config, OutputConfig, ProcessingConfig
app_module = importlib.import_module("app.__init__")
class TestConfigurationErrorHandling:
def test_zero_values(self) -> None:
"""Test configuration with zero values where appropriate.... | 0 | assert | numeric_literal | src/tests/test_config_error_handling.py | test_zero_values | TestConfigurationErrorHandling | 56 | null |
podly-pure-podcasts/podly_pure_podcasts | import pytest
from app.extensions import db
from app.feeds import get_user_aggregate_posts
from app.models import Feed, Post, UserFeed
def test_get_user_aggregate_posts_auth_disabled(app):
"""Test that all feeds are included when auth is disabled."""
with app.app_context():
app.config["REQUIRE_AUTH"] ... | posts | assert | variable | src/tests/test_aggregate_feed.py | test_get_user_aggregate_posts_auth_disabled | 43 | null | |
podly-pure-podcasts/podly_pure_podcasts | import datetime
import logging
import uuid
from types import SimpleNamespace
from unittest import mock
import feedparser
import PyRSS2Gen
import pytest
from app.feeds import (
_get_base_url,
_should_auto_whitelist_new_posts,
add_feed,
db,
feed_item,
fetch_feed,
generate_feed_xml,
get_d... | 3600 | assert | numeric_literal | src/tests/test_feeds.py | test_get_duration_with_valid_duration | 793 | null | |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
import pytest
from podcast_processor.llm_concurrency_limiter import (
ConcurrencyContext,
LLMConcurrencyLimiter,
get_concurrency_limiter,
)
class TestLLMConcurrencyLimiter:
def test_acquire_and_release(self):
"""Test basic acquire and release functionality."""
... | 2 | assert | numeric_literal | src/tests/test_llm_concurrency_limiter.py | test_acquire_and_release | TestLLMConcurrencyLimiter | 44 | null |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | 404) | assert_* | numeric_literal | src/tests/test_podcast_downloader.py | test_download_episode_invalid_url | 176 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Any
from shared.config import Config
class TestRateLimitingConfig:
def test_custom_rate_limiting_config(self) -> None:
"""Test that custom rate limiting values are properly set."""
config_data: dict[str, Any] = {
"llm_api_key": "test-key",
"llm_max_concu... | 100000 | assert | numeric_literal | src/tests/test_rate_limiting_config.py | test_custom_rate_limiting_config | TestRateLimitingConfig | 64 | null |
podly-pure-podcasts/podly_pure_podcasts | import logging
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from app.extensions import db
from app.models import Feed, Identification, Post, TranscriptSegment
from podcast_processor.audio_processor import AudioProcessor
from shared.config import Config
from shared.test_utils import... | (20000, 25000) | assert | collection | src/tests/test_audio_processor.py | test_merge_ad_segments | 103 | null | |
podly-pure-podcasts/podly_pure_podcasts | from unittest import mock
import pytest
from app.models import Feed, Post
from podcast_processor.podcast_downloader import (
PodcastDownloader,
find_audio_link,
sanitize_title,
)
def downloader(tmp_path):
"""Create a PodcastDownloader instance with a temporary directory."""
return PodcastDownload... | "https://example.com/episode-id" | assert | string_literal | src/tests/test_podcast_downloader.py | test_find_audio_link_without_audio_link | 88 | null | |
podly-pure-podcasts/podly_pure_podcasts | import threading
import time
from unittest.mock import patch
from podcast_processor.token_rate_limiter import (
TokenRateLimiter,
configure_rate_limiter_for_model,
get_rate_limiter,
)
class TestTokenRateLimiter:
def test_initialization(self) -> None:
"""Test rate limiter initialization with d... | 0 | assert | numeric_literal | src/tests/test_token_rate_limiter.py | test_initialization | TestTokenRateLimiter | 25 | null |
podly-pure-podcasts/podly_pure_podcasts | import tempfile
from pathlib import Path
from podcast_processor.audio import (
clip_segments_with_fade,
get_audio_duration_ms,
split_audio,
)
TEST_FILE_DURATION = 66_048
TEST_FILE_PATH = "src/tests/data/count_0_99.mp3"
def test_split_audio() -> None:
with tempfile.TemporaryDirectory() as temp_dir:
... | expected | assert | variable | src/tests/test_process_audio.py | test_split_audio | 119 | null | |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from datetime import datetime, timedelta
from pathlib import Path
from app.extensions import db
from app.models import (
Feed,
Identification,
ModelCall,
Post,
ProcessingJob,
TranscriptSegment,
)
from app.post_cleanup import cleanup_processed_posts, count_cle... | 1 | assert | numeric_literal | src/tests/test_post_cleanup.py | test_cleanup_removes_expired_posts | 126 | null | |
podly-pure-podcasts/podly_pure_podcasts | from typing import Generator
from unittest.mock import MagicMock, patch
import pytest
from flask import Flask
from jinja2 import Template
from litellm.exceptions import InternalServerError
from litellm.types.utils import Choices
from app.extensions import db
from app.models import ModelCall, Post, TranscriptSegment
f... | "test response" | assert | string_literal | src/tests/test_ad_classifier.py | test_call_model | 108 | null | |
podly-pure-podcasts/podly_pure_podcasts | import tempfile
from pathlib import Path
from podcast_processor.audio import (
clip_segments_with_fade,
get_audio_duration_ms,
split_audio,
)
TEST_FILE_DURATION = 66_048
TEST_FILE_PATH = "src/tests/data/count_0_99.mp3"
def test_split_audio() -> None:
with tempfile.TemporaryDirectory() as temp_dir:
... | 500 | assert | numeric_literal | src/tests/test_process_audio.py | test_split_audio | 129 | null | |
podly-pure-podcasts/podly_pure_podcasts | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import pytest
from flask import Flask, Response, g, jsonify
from app.auth import AuthSettings
from app.auth.middleware import init_auth_middleware
from app.auth.state import failure_rate_limiter
from app.extensions import db
from app.mode... | 401 | assert | numeric_literal | src/tests/test_session_auth.py | test_logout_clears_session | 108 | null | |
podly-pure-podcasts/podly_pure_podcasts | import time
from typing import Any
from unittest.mock import patch
from podcast_processor.ad_classifier import AdClassifier
from podcast_processor.token_rate_limiter import TokenRateLimiter
from .test_helpers import create_test_config
class TestRateLimitingEdgeCases:
def test_thread_safety_stress(self) -> None:... | 5.0 | assert | numeric_literal | src/tests/test_rate_limiting_edge_cases.py | test_thread_safety_stress | TestRateLimitingEdgeCases | 292 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.