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 |
|---|---|---|---|---|---|---|---|---|---|
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.types import basescope2languageid
from LSP.plugin.core.types import diff
from LSP.plugin.core.types import DocumentSelector_
from unittest.mock import MagicMock
import sublime
import unittest
class TestDiff(unittest.TestCase):
def test_remove(self) -> None:... | set(("a",))) | self.assertEqual | func_call | tests/test_types.py | test_remove | TestDiff | 21 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.collections import DottedDict
from LSP.plugin.core.edit import Promise
from LSP.plugin.core.protocol import Error
from LSP.plugin.core.sessions import get_initialize_params
from LSP.plugin.core.sessions import Logger
from LSP.plugin.core.sessions import Manager
f... | (True, True)) | self.assertEqual | collection | tests/test_session.py | test_document_sync_capabilities | SessionTest | 243 | null |
sublimelsp/LSP | from __future__ import annotations
from copy import deepcopy
from LSP.plugin import apply_text_edits
from LSP.plugin import Request
from LSP.plugin.core.protocol import UINT_MAX
from LSP.plugin.core.url import filename_to_uri
from LSP.plugin.core.views import entire_content
from LSP.plugin.hover import _test_contents
... | "") | self.assertEqual | string_literal | tests/test_single_document.py | test_expand_selection | SingleDocumentTestCase | 279 | null |
sublimelsp/LSP | from __future__ import annotations
from copy import deepcopy
from LSP.plugin.code_actions import CodeActionsOnFormatOnSaveTask
from LSP.plugin.code_actions import get_matching_on_save_kinds
from LSP.plugin.core.constants import RegionKey
from LSP.plugin.core.protocol import Point
from LSP.plugin.core.settings import u... | 0) | self.assertEqual | numeric_literal | tests/test_code_actions.py | test_requests_with_diagnostics | CodeActionsListenerTestCase | 413 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.url import filename_to_uri
from LSP.plugin.core.url import parse_uri
from LSP.plugin.core.url import view_to_uri
import os
import sublime
import sys
import unittest
import unittest.mock
class MultiplatformTests(unittest.TestCase):
def test_buffer_uri(self) ... | "buffer:42") | self.assertEqual | string_literal | tests/test_url.py | test_buffer_uri | MultiplatformTests | 75 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.collections import DottedDict
from typing import Any
from unittest import TestCase
class DottedDictTests(TestCase):
def verify(self, d: DottedDict, path: str, value: Any) -> None:
self.assertEqual(d.get(path), value)
def test_remove(self) -> No... | d) | self.assertIn | variable | tests/test_collections.py | test_remove | DottedDictTests | 51 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin import filename_to_uri
from LSP.plugin import FileWatcher
from LSP.plugin import FileWatcherEvent
from LSP.plugin import FileWatcherEventType
from LSP.plugin import FileWatcherProtocol
from LSP.plugin import parse_uri
from LSP.plugin.core.file_watcher import file_watc... | list) | self.assertIs | variable | tests/test_file_watcher.py | test_handles_file_event | FileWatcherStaticTests | 148 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.workspace import is_subpath_of
from LSP.plugin.core.workspace import sorted_workspace_folders
from LSP.plugin.core.workspace import WorkspaceFolder
import os
import tempfile
import unittest
class SortedWorkspaceFoldersTest(unittest.TestCase):
def test_get_w... | unrelated_folder) | self.assertEqual | variable | tests/test_workspace.py | test_get_workspace_from_multi_folder_project | SortedWorkspaceFoldersTest | 24 | null |
sublimelsp/LSP | from __future__ import annotations
from copy import deepcopy
from LSP.plugin.completion import completion_with_defaults
from LSP.plugin.completion import format_completion
from LSP.protocol import CompletionItem
from LSP.protocol import CompletionItemDefaults
from LSP.protocol import CompletionItemKind
from LSP.protoc... | '\t\n\ta\n\t\tb') | self.assertEqual | string_literal | tests/test_completion.py | test_text_edit_plaintext_with_multiple_lines_indented | QueryCompletionsTests | 617 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.configurations import WindowConfigManager
from test_mocks import DISABLED_CONFIG
from test_mocks import TEST_CONFIG
from unittest import TestCase
from unittest.mock import MagicMock
from unittesting import ViewTestCase
import sublime
class GlobalConfigManagerTes... | TEST_CONFIG.enabled) | self.assertTrue | complex_expr | tests/test_configurations.py | test_override_config | GlobalConfigManagerTests | 23 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin import apply_text_edits
from LSP.plugin.core.edit import parse_workspace_edit
from LSP.plugin.core.url import filename_to_uri
from LSP.plugin.core.views import entire_content
from LSP.plugin.edit import _parse_text_edit as parse_text_edit
from LSP.plugin.edit import _... | 11) | self.assertEqual | numeric_literal | tests/test_edit.py | test_parse_from_lsp | TextEditTests | 168 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.collections import DottedDict
from LSP.plugin.core.edit import Promise
from LSP.plugin.core.protocol import Error
from LSP.plugin.core.sessions import get_initialize_params
from LSP.plugin.core.sessions import Logger
from LSP.plugin.core.sessions import Manager
f... | "some-scheme://whatever") | self.assertEqual | string_literal | tests/test_session.py | test_get_session_buffer_for_uri_with_nonfiles | SessionTest | 281 | null |
sublimelsp/LSP | from __future__ import annotations
from LSP.plugin.core.types import basescope2languageid
from LSP.plugin.core.types import diff
from LSP.plugin.core.types import DocumentSelector_
from unittest.mock import MagicMock
import sublime
import unittest
class TestDocumentSelector(unittest.TestCase):
def setUp(self) ->... | selector.matches(view)) | self.assertTrue | func_call | tests/test_types.py | test_language | TestDocumentSelector | 66 | null |
denizsafak/abogen | from abogen.speaker_analysis import analyze_speakers
def _chapters():
return [
{
"id": "0001",
"index": 0,
"title": "Test",
"text": "",
"enabled": True,
}
]
def _chunk(text: str, idx: int) -> dict:
return {
"id": f"chunk-{... | excerpt | assert | variable | tests/test_speaker_analysis.py | test_sample_excerpt_includes_context_paragraphs | 94 | null | |
denizsafak/abogen | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | minimum | assert | variable | tests/test_debug_tts_samples.py | test_debug_samples_have_minimum_per_category | 136 | null | |
denizsafak/abogen | from __future__ import annotations
import pytest
from unittest.mock import patch
from abogen.kokoro_text_normalization import (
DEFAULT_APOSTROPHE_CONFIG,
normalize_for_pipeline,
normalize_roman_numeral_titles,
)
from abogen.normalization_settings import (
apply_overrides as apply_normalization_overri... | titles | assert | variable | tests/test_text_normalization.py | test_normalize_roman_titles_skips_when_not_majority | 87 | null | |
denizsafak/abogen | import unittest
import os
import sys
import shutil
import fitz # PyMuPDF
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, PdfParser, EpubParser, MarkdownParser
class TestBookParser(unittest.TestCase):
de... | MarkdownParser) | self.assertIsInstance | variable | tests/test_book_parser.py | test_factory_returns_correct_class | TestBookParser | 87 | null |
denizsafak/abogen | from __future__ import annotations
import html
import re
import zipfile
from abogen.epub3.exporter import build_epub3_package
from abogen.text_extractor import ExtractedChapter, ExtractionResult
def _make_sample_extraction() -> ExtractionResult:
return ExtractionResult(
chapters=[
ExtractedCh... | chunk_section | assert | variable | tests/test_epub_exporter.py | test_epub3_preserves_original_whitespace | 192 | null | |
denizsafak/abogen | from pathlib import Path
from werkzeug.datastructures import MultiDict
from abogen.webui.routes.utils.form import apply_book_step_form
from abogen.webui.service import PendingJob
def _make_pending_job() -> PendingJob:
pending = PendingJob(
id="pending",
original_filename="example.epub",
s... | "kokoro" | assert | string_literal | tests/test_book_step_speaker_provider.py | test_book_step_supertonic_profile_becomes_speaker_reference | 83 | null | |
denizsafak/abogen | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_normalize_chapter_opening_caps_respects_acronyms() -> None:
normalized, changed = _normalize_chapter_o... | "NASA Mission Log" | assert | string_literal | tests/test_conversion_chapter_titles.py | test_normalize_chapter_opening_caps_respects_acronyms | 113 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import sys
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubContentSlicing(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_dat... | text2) | self.assertIn | variable | tests/test_epub_content_slicing.py | test_single_file_multiple_chapters | TestEpubContentSlicing | 116 | null |
denizsafak/abogen | from __future__ import annotations
from pathlib import Path
from abogen.webui.conversion_runner import _render_ffmetadata, _write_ffmetadata_file
def test_render_ffmetadata_includes_chapters(tmp_path):
metadata = {
"title": "Sample Book",
"artist": "Author Name",
"comment": "Line one\nLin... | rendered | assert | variable | tests/test_ffmetadata.py | test_render_ffmetadata_includes_chapters | 22 | null | |
denizsafak/abogen | import numpy as np
from abogen.tts_supertonic import SupertonicPipeline
def test_supertonic_pipeline_drops_chunk_if_only_unsupported_characters():
pipeline = SupertonicPipeline.__new__(SupertonicPipeline)
pipeline.sample_rate = 24000
pipeline.total_steps = 5
pipeline.max_chunk_length = 1000
pipeli... | [] | assert | collection | tests/test_tts_supertonic_unsupported_chars.py | test_supertonic_pipeline_drops_chunk_if_only_unsupported_characters | 53 | null | |
denizsafak/abogen | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | location | assert | variable | tests/test_debug_tts_samples.py | test_settings_debug_route_writes_manifest | 98 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | 2) | self.assertEqual | numeric_literal | tests/test_pdf_structure.py | test_pdf_structure_with_toc | TestPdfStructure | 45 | null |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | children[0]['title']) | self.assertIn | complex_expr | tests/test_pdf_structure.py | test_pdf_structure_without_toc | TestPdfStructure | 86 | null |
denizsafak/abogen | from __future__ import annotations
import json
from abogen.integrations.audiobookshelf import (
AudiobookshelfClient,
AudiobookshelfConfig,
)
def test_upload_fields_include_series_sequence(tmp_path):
audio_path = tmp_path / "book.mp3"
audio_path.write_bytes(b"audio")
config = AudiobookshelfConfi... | "Example Saga" | assert | string_literal | tests/test_audiobookshelf_client.py | test_upload_fields_include_series_sequence | 33 | null | |
denizsafak/abogen | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_retry_removes_failed_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mk... | job_ids | assert | variable | tests/test_service.py | test_retry_removes_failed_job | 205 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import zipfile
import sys
import logging
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubMissingFileErrorHandling(unittest.TestCase):
def setUp(self):... | chap1_found) | self.assertTrue | variable | tests/test_epub_missing_file_error_handling.py | test_missing_file_recovery | TestEpubMissingFileErrorHandling | 93 | null |
denizsafak/abogen | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_chunk_voice_spec_uses_fallback_when_no_overrides() -> None:
job = SimpleNamespace(voice="base_voice", speaker... | "fallback" | assert | string_literal | tests/test_chunk_helpers.py | test_chunk_voice_spec_uses_fallback_when_no_overrides | 42 | null | |
denizsafak/abogen | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_strip_duplicate_heading_line_removes_first_match() -> None:
text, removed = _strip_duplicate_heading_l... | True | assert | bool_literal | tests/test_conversion_chapter_titles.py | test_strip_duplicate_heading_line_removes_first_match | 101 | null | |
denizsafak/abogen | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_extracts_tags_and_rating_from_summary() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"... | "Saga" | assert | string_literal | tests/test_calibre_opds.py | test_calibre_opds_extracts_tags_and_rating_from_summary | 157 | null | |
denizsafak/abogen | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_chunk_text_display_preserves_whitespace() -> None:
text = "Line one with double spaces.\nSecond line\n\nThi... | first_display | assert | variable | tests/test_chunk_helpers.py | test_chunk_text_display_preserves_whitespace | 80 | null | |
denizsafak/abogen | from __future__ import annotations
from pathlib import Path
from abogen.webui.conversion_runner import _render_ffmetadata, _write_ffmetadata_file
def test_render_ffmetadata_includes_chapters(tmp_path):
metadata = {
"title": "Sample Book",
"artist": "Author Name",
"comment": "Line one\nLin... | None | assert | none_literal | tests/test_ffmetadata.py | test_render_ffmetadata_includes_chapters | 34 | null | |
denizsafak/abogen | from __future__ import annotations
from abogen.webui.routes.api import _opds_metadata_overrides
def test_opds_metadata_overrides_maps_author_and_subtitle() -> None:
overrides = _opds_metadata_overrides(
{
"authors": ["Alexandre Dumas"],
"subtitle": "Unabridged",
"series... | "2" | assert | string_literal | tests/test_opds_import_metadata_mapping.py | test_opds_metadata_overrides_maps_author_and_subtitle | 24 | null | |
denizsafak/abogen | from __future__ import annotations
import sys
import types
def _install_dependency_stubs() -> None:
if "ebooklib" not in sys.modules:
ebooklib_stub = types.ModuleType("ebooklib")
epub_stub = types.ModuleType("ebooklib.epub")
setattr(ebooklib_stub, "epub", epub_stub)
sys.modules["eb... | "Another" | assert | string_literal | tests/test_chapter_overrides.py | test_merge_metadata_prefers_overrides_and_drops_none_values | 193 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import sys
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubHtmlNavParsing(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_dat... | "html") | self.assertEqual | string_literal | tests/test_epub_html_nav_parsing.py | test_identify_nav_item | TestEpubHtmlNavParsing | 181 | null |
denizsafak/abogen | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | project_root | assert | variable | tests/test_output_paths.py | test_prepare_project_layout_uses_timestamped_folder | 49 | null | |
denizsafak/abogen | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_group_chunks_by_chapter_orders_and_groups() -> None:
chunks = [
{"chapter_index": "0", "chunk_index":... | "next" | assert | string_literal | tests/test_chunk_helpers.py | test_group_chunks_by_chapter_orders_and_groups | 19 | null | |
denizsafak/abogen | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | normalized["FOOT_001"] | assert | complex_expr | tests/test_debug_tts_samples.py | test_debug_samples_normalize_smoke | 55 | null | |
denizsafak/abogen | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | audio_dir / "Sample_Title.wav" | assert | complex_expr | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | 79 | null | |
denizsafak/abogen | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | {302, 303} | assert | collection | tests/test_debug_tts_samples.py | test_settings_debug_route_writes_manifest | 96 | null | |
denizsafak/abogen | from __future__ import annotations
import html
import re
import zipfile
from abogen.epub3.exporter import build_epub3_package
from abogen.text_extractor import ExtractedChapter, ExtractionResult
def _make_sample_extraction() -> ExtractionResult:
return ExtractionResult(
chapters=[
ExtractedCh... | None | assert | none_literal | tests/test_epub_exporter.py | test_epub3_preserves_original_whitespace | 198 | null | |
denizsafak/abogen | from __future__ import annotations
import sys
import types
def _install_dependency_stubs() -> None:
if "ebooklib" not in sys.modules:
ebooklib_stub = types.ModuleType("ebooklib")
epub_stub = types.ModuleType("ebooklib.epub")
setattr(ebooklib_stub, "epub", epub_stub)
sys.modules["eb... | "Intro" | assert | string_literal | tests/test_chapter_overrides.py | test_apply_chapter_overrides_with_custom_text | 129 | null | |
denizsafak/abogen | from __future__ import annotations
import html
import re
import zipfile
from abogen.epub3.exporter import build_epub3_package
from abogen.text_extractor import ExtractedChapter, ExtractionResult
def _make_sample_extraction() -> ExtractionResult:
return ExtractionResult(
chapters=[
ExtractedCh... | chapter_doc | assert | variable | tests/test_epub_exporter.py | test_epub3_preserves_original_whitespace | 189 | null | |
denizsafak/abogen | from unittest.mock import patch
import pytest
from pathlib import Path
from ebooklib import epub
from abogen.text_extractor import extract_from_path
from abogen.utils import calculate_text_length
def sample_epub_path():
return Path(__file__).parent / "fixtures" / "abogen_debug_tts_samples.epub"
def test_epub_m... | artist | assert | variable | tests/test_text_extractor.py | test_epub_metadata_composer_matches_artist | 33 | null | |
denizsafak/abogen | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_retry_removes_failed_job(tmp_path):
uploads = tmp_path / "uploads"
outputs = tmp_path / "outputs"
uploads.mk... | job.id | assert | complex_expr | tests/test_service.py | test_retry_removes_failed_job | 202 | null | |
denizsafak/abogen | import unittest
import os
import sys
import shutil
import fitz # PyMuPDF
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, PdfParser, EpubParser, MarkdownParser
class TestBookParser(unittest.TestCase):
de... | "markdown") | self.assertEqual | string_literal | tests/test_book_parser.py | test_file_type_property | TestBookParser | 215 | null |
denizsafak/abogen | import pytest
from abogen.kokoro_text_normalization import (
_normalize_grouped_numbers,
ApostropheConfig,
)
def cfg():
return ApostropheConfig(convert_numbers=True, year_pronunciation_mode="american")
def normalize(text, config):
return _normalize_grouped_numbers(text, config)
class TestDateNormaliz... | normalize(text, cfg) | assert | func_call | tests/test_date_normalization_comprehensive.py | test_address_context_window | TestDateNormalization | 99 | null |
denizsafak/abogen | import unittest
import os
import shutil
import sys
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubHtmlNavParsing(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_dat... | ids) | self.assertIn | variable | tests/test_epub_html_nav_parsing.py | test_nested_html_nav_parsing | TestEpubHtmlNavParsing | 126 | null |
denizsafak/abogen | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | combined | assert | variable | tests/test_debug_tts_samples.py | test_debug_epub_contains_all_codes | 30 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import sys
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubHtmlNavParsing(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_dat... | "Chapter 2") | self.assertEqual | string_literal | tests/test_epub_html_nav_parsing.py | test_basic_html_nav_parsing | TestEpubHtmlNavParsing | 100 | null |
denizsafak/abogen | from unittest.mock import patch
import pytest
from pathlib import Path
from ebooklib import epub
from abogen.text_extractor import extract_from_path
from abogen.utils import calculate_text_length
def sample_epub_path():
return Path(__file__).parent / "fixtures" / "abogen_debug_tts_samples.epub"
def test_epub_s... | "Example Saga" | assert | string_literal | tests/test_text_extractor.py | test_epub_series_metadata_extracted_from_opf_meta | 74 | null | |
denizsafak/abogen | from types import SimpleNamespace
from typing import cast
import pytest
from abogen.constants import VOICES_INTERNAL
from abogen.voice_cache import (
LocalEntryNotFoundError,
_CACHED_VOICES,
ensure_voice_assets,
)
from abogen.webui.conversion_runner import _collect_required_voice_ids
from abogen.webui.ser... | set() | assert | func_call | tests/test_voice_cache.py | test_ensure_voice_assets_downloads_missing | 50 | null | |
denizsafak/abogen | from pathlib import Path
from werkzeug.datastructures import MultiDict
from abogen.webui.routes.utils.form import apply_book_step_form
from abogen.webui.service import PendingJob
def _make_pending_job() -> PendingJob:
pending = PendingJob(
id="pending",
original_filename="example.epub",
s... | "speaker:Female HQ" | assert | string_literal | tests/test_book_step_speaker_provider.py | test_book_step_supertonic_profile_becomes_speaker_reference | 79 | null | |
denizsafak/abogen | from __future__ import annotations
import io
import time
from abogen.webui.service import (
Job,
JobStatus,
build_service,
_JOB_LOGGER,
build_audiobookshelf_metadata,
)
def test_audiobookshelf_metadata_uses_book_number(tmp_path):
source = tmp_path / "book.txt"
source.write_text("content", ... | "7" | assert | string_literal | tests/test_service.py | test_audiobookshelf_metadata_uses_book_number | 239 | null | |
denizsafak/abogen | from types import SimpleNamespace
from typing import cast
import pytest
from abogen.constants import VOICES_INTERNAL
from abogen.voice_cache import (
LocalEntryNotFoundError,
_CACHED_VOICES,
ensure_voice_assets,
)
from abogen.webui.conversion_runner import _collect_required_voice_ids
from abogen.webui.ser... | [] | assert | collection | tests/test_voice_cache.py | test_ensure_voice_assets_downloads_missing | 52 | null | |
denizsafak/abogen | import numpy as np
from abogen.tts_supertonic import SupertonicPipeline
def test_supertonic_pipeline_strips_unsupported_characters_and_retries():
# Avoid importing/initializing real supertonic by manually constructing the pipeline.
pipeline = SupertonicPipeline.__new__(SupertonicPipeline)
pipeline.sample_... | 0 | assert | numeric_literal | tests/test_tts_supertonic_unsupported_chars.py | test_supertonic_pipeline_strips_unsupported_characters_and_retries | 42 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | "page_2") | self.assertEqual | string_literal | tests/test_pdf_structure.py | test_pdf_structure_nested_toc | TestPdfStructure | 114 | null |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | "Sec 1.1") | self.assertEqual | string_literal | tests/test_pdf_structure.py | test_pdf_structure_nested_toc | TestPdfStructure | 113 | null |
denizsafak/abogen | import pytest
from abogen.kokoro_text_normalization import (
_normalize_grouped_numbers,
ApostropheConfig,
)
def cfg():
return ApostropheConfig(convert_numbers=True, year_pronunciation_mode="american")
def normalize(text, config):
return _normalize_grouped_numbers(text, config)
class TestDateNormaliz... | normalize("3400", cfg) | assert | func_call | tests/test_date_normalization_comprehensive.py | test_specific_user_examples | TestDateNormalization | 82 | null |
denizsafak/abogen | from abogen.speaker_analysis import analyze_speakers
def _chapters():
return [
{
"id": "0001",
"index": 0,
"title": "Test",
"text": "",
"enabled": True,
}
]
def _chunk(text: str, idx: int) -> dict:
return {
"id": f"chunk-{... | True | assert | bool_literal | tests/test_speaker_analysis.py | test_analyze_speakers_applies_threshold_suppression | 77 | null | |
denizsafak/abogen | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_search_filters_by_title_and_author() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
feed = OPDSFeed(
id="catalog",
title=... | ["2"] | assert | collection | tests/test_calibre_opds.py | test_calibre_opds_search_filters_by_title_and_author | 290 | null | |
denizsafak/abogen | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_normalize_chapter_opening_caps_handles_roman_numerals() -> None:
normalized, changed = _normalize_chap... | "IV. The Return" | assert | string_literal | tests/test_conversion_chapter_titles.py | test_normalize_chapter_opening_caps_handles_roman_numerals | 119 | null | |
denizsafak/abogen | import unittest
import os
import sys
import shutil
import time
from PyQt6.QtWidgets import QApplication
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.pyqt.book_handler import HandlerDialog
from ebooklib import epub
app = QApplication(sys.argv)
class TestBookHandlerRe... | found_intro) | self.assertTrue | variable | tests/test_book_handler_regression.py | test_handler_initialization | TestBookHandlerRegression | 82 | null |
denizsafak/abogen | from __future__ import annotations
import html
import re
import zipfile
from abogen.epub3.exporter import build_epub3_package
from abogen.text_extractor import ExtractedChapter, ExtractionResult
def _make_sample_extraction() -> ExtractionResult:
return ExtractionResult(
chapters=[
ExtractedCh... | names | assert | variable | tests/test_epub_exporter.py | test_build_epub3_package_creates_expected_structure | 82 | null | |
denizsafak/abogen | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_group_chunks_by_chapter_orders_and_groups() -> None:
chunks = [
{"chapter_index": "0", "chunk_index":... | ["body", "tail"] | assert | collection | tests/test_chunk_helpers.py | test_group_chunks_by_chapter_orders_and_groups | 18 | null | |
denizsafak/abogen | from __future__ import annotations
import sys
import types
def _install_dependency_stubs() -> None:
if "ebooklib" not in sys.modules:
ebooklib_stub = types.ModuleType("ebooklib")
epub_stub = types.ModuleType("ebooklib.epub")
setattr(ebooklib_stub, "epub", epub_stub)
sys.modules["eb... | "Hello world" | assert | string_literal | tests/test_chapter_overrides.py | test_apply_chapter_overrides_with_custom_text | 130 | null | |
denizsafak/abogen | import json
from pathlib import Path
import numpy as np
import pytest
from abogen.debug_tts_samples import (
DEBUG_TTS_SAMPLES,
MARKER_PREFIX,
MARKER_SUFFIX,
iter_expected_codes,
)
from abogen.kokoro_text_normalization import HAS_NUM2WORDS, normalize_for_pipeline
from abogen.normalization_settings imp... | normalized["NUM_001"].lower() | assert | func_call | tests/test_debug_tts_samples.py | test_debug_samples_normalize_smoke | 63 | null | |
denizsafak/abogen | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | None | assert | none_literal | tests/test_output_paths.py | test_prepare_project_layout_uses_timestamped_folder | 51 | null | |
denizsafak/abogen | from unittest.mock import patch
import pytest
from pathlib import Path
from ebooklib import epub
from abogen.text_extractor import extract_from_path
from abogen.utils import calculate_text_length
def sample_epub_path():
return Path(__file__).parent / "fixtures" / "abogen_debug_tts_samples.epub"
def test_epub_c... | combined_total | assert | variable | tests/test_text_extractor.py | test_epub_character_counts_align_with_calculated_total | 23 | null | |
denizsafak/abogen | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_feed_extracts_series_from_categories() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"U... | 5.0 | assert | numeric_literal | tests/test_calibre_opds.py | test_calibre_opds_feed_extracts_series_from_categories | 95 | null | |
denizsafak/abogen | import pytest
from unittest.mock import patch
from abogen.kokoro_text_normalization import (
normalize_for_pipeline,
DEFAULT_APOSTROPHE_CONFIG,
)
from abogen.normalization_settings import build_apostrophe_config, _SETTINGS_DEFAULTS
def normalize(text, overrides=None):
settings = dict(_SETTINGS_DEFAULTS)
... | "a" | assert | string_literal | tests/test_regression_fixes.py | test_manual_override_normalization | 91 | null | |
denizsafak/abogen | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_format_spoken_chapter_title_adds_prefix() -> None:
assert _format_spoken_chapter_title("1: A Tale", 1... | "Chapter 1. A Tale" | assert | string_literal | tests/test_conversion_chapter_titles.py | test_format_spoken_chapter_title_adds_prefix | 73 | null | |
denizsafak/abogen | import pytest
from abogen.kokoro_text_normalization import (
_normalize_grouped_numbers,
ApostropheConfig,
)
def cfg():
return ApostropheConfig(convert_numbers=True, year_pronunciation_mode="american")
def normalize(text, config):
return _normalize_grouped_numbers(text, config)
class TestDateNormaliz... | normalize("1925", cfg) | assert | func_call | tests/test_date_normalization_comprehensive.py | test_specific_user_examples | TestDateNormalization | 80 | null |
denizsafak/abogen | from abogen.webui.routes.utils import preview
def test_preview_applies_manual_override_before_normalization(monkeypatch):
# Don't run real TTS/normalization; just exercise the override stage by
# forcing provider=kokoro and then stubbing normalize_for_pipeline.
monkeypatch.setattr(preview, "get_preview_pi... | captured["text"] | assert | complex_expr | tests/test_preview_applies_manual_overrides.py | test_preview_applies_manual_override_before_normalization | 54 | null | |
denizsafak/abogen | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_extracts_tags_and_rating_from_summary() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"... | 3.0 | assert | numeric_literal | tests/test_calibre_opds.py | test_calibre_opds_extracts_tags_and_rating_from_summary | 158 | null | |
denizsafak/abogen | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_chunk_text_display_preserves_whitespace() -> None:
text = "Line one with double spaces.\nSecond line\n\nThi... | "Third paragraph." | assert | string_literal | tests/test_chunk_helpers.py | test_chunk_text_display_preserves_whitespace | 83 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | 1) | self.assertEqual | numeric_literal | tests/test_pdf_structure.py | test_pdf_structure_with_toc | TestPdfStructure | 53 | null |
denizsafak/abogen | from __future__ import annotations
from types import SimpleNamespace
from abogen.chunking import chunk_text
from abogen.webui.conversion_runner import _chunk_voice_spec, _group_chunks_by_chapter
def test_chunk_voice_spec_prefers_chunk_overrides() -> None:
job = SimpleNamespace(voice="base_voice", speakers={})
... | "override_voice" | assert | string_literal | tests/test_chunk_helpers.py | test_chunk_voice_spec_prefers_chunk_overrides | 26 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import sys
from ebooklib import epub
import ebooklib
from unittest.mock import MagicMock
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser
class TestEpubStandardNav(unittest.TestCase):
def set... | ["nav"]) | self.assertEqual | collection | tests/test_epub_standard_nav.py | test_discovery_by_nav_property | TestEpubStandardNav | 129 | null |
denizsafak/abogen | from pathlib import Path
from werkzeug.datastructures import MultiDict
from abogen.webui.routes.utils.form import apply_prepare_form
from abogen.webui.routes.utils.voice import resolve_voice_setting
from abogen.webui.service import PendingJob
def _make_pending_job() -> PendingJob:
return PendingJob(
id="... | hero | assert | variable | tests/test_prepare_form.py | test_apply_prepare_form_accepts_saved_speaker_reference_for_voice | 91 | null | |
denizsafak/abogen | from __future__ import annotations
from abogen.webui.routes.api import _opds_metadata_overrides
def test_opds_metadata_overrides_accepts_author_string() -> None:
overrides = _opds_metadata_overrides({"author": "Mary Shelley"})
assert overrides["authors"] == | "Mary Shelley" | assert | string_literal | tests/test_opds_import_metadata_mapping.py | test_opds_metadata_overrides_accepts_author_string | 31 | null | |
denizsafak/abogen | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_normalize_chapter_opening_caps_keeps_mixed_case() -> None:
normalized, changed = _normalize_chapter_op... | False | assert | bool_literal | tests/test_conversion_chapter_titles.py | test_normalize_chapter_opening_caps_keeps_mixed_case | 126 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | "page_1") | self.assertEqual | string_literal | tests/test_pdf_structure.py | test_pdf_structure_with_toc | TestPdfStructure | 47 | null |
denizsafak/abogen | import unittest
import os
import shutil
import fitz # PyMuPDF
from abogen.book_parser import PdfParser
class TestPdfStructure(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/test_data_pdf"
if os.path.exists(self.test_dir):
shutil.rmtree(self.test_dir)
os.makedirs(s... | children[1]['title']) | self.assertIn | complex_expr | tests/test_pdf_structure.py | test_pdf_structure_without_toc | TestPdfStructure | 87 | null |
denizsafak/abogen | from pathlib import Path
from werkzeug.datastructures import MultiDict
from abogen.webui.routes.utils.form import apply_book_step_form
from abogen.webui.service import PendingJob
def _make_pending_job() -> PendingJob:
pending = PendingJob(
id="pending",
original_filename="example.epub",
s... | "Female HQ" | assert | string_literal | tests/test_book_step_speaker_provider.py | test_book_step_supertonic_profile_becomes_speaker_reference | 80 | null | |
denizsafak/abogen | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | project_root / "metadata" | assert | complex_expr | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | 73 | null | |
denizsafak/abogen | import unittest
import os
import sys
import shutil
import fitz # PyMuPDF
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, PdfParser, EpubParser, MarkdownParser
class TestBookParser(unittest.TestCase):
de... | 2) | self.assertEqual | numeric_literal | tests/test_book_parser.py | test_get_chapters | TestBookParser | 186 | null |
denizsafak/abogen | from __future__ import annotations
import time
from pathlib import Path
import pytest
from abogen.webui.conversion_runner import _build_output_path, _prepare_project_layout
from abogen.webui.service import Job
def _sample_job(tmp_path: Path) -> Job:
source = tmp_path / "sample.txt"
source.write_text("exampl... | project_root / "subtitles" | assert | complex_expr | tests/test_output_paths.py | test_prepare_project_layout_creates_project_subdirs | 72 | null | |
denizsafak/abogen | from types import SimpleNamespace
from typing import cast
import pytest
from abogen.constants import VOICES_INTERNAL
from abogen.voice_cache import (
LocalEntryNotFoundError,
_CACHED_VOICES,
ensure_voice_assets,
)
from abogen.webui.conversion_runner import _collect_required_voice_ids
from abogen.webui.ser... | {} | assert | collection | tests/test_voice_cache.py | test_ensure_voice_assets_downloads_missing | 44 | null | |
denizsafak/abogen | from abogen.webui.conversion_runner import _chunk_text_for_tts
def test_chunk_text_for_tts_falls_back_to_original_text_then_normalized_text():
entry = {
"original_text": "Hello * world",
"normalized_text": "Hello world",
}
assert _chunk_text_for_tts(entry) == | "Hello * world" | assert | string_literal | tests/test_chunk_text_for_tts_prefers_raw.py | test_chunk_text_for_tts_falls_back_to_original_text_then_normalized_text | 20 | null | |
denizsafak/abogen | import unittest
import os
import sys
import shutil
import fitz # PyMuPDF
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, PdfParser, EpubParser, MarkdownParser
class TestBookParser(unittest.TestCase):
de... | EpubParser) | self.assertIsInstance | variable | tests/test_book_parser.py | test_factory_returns_correct_class | TestBookParser | 90 | null |
denizsafak/abogen | import unittest
import os
import sys
import shutil
import time
from PyQt6.QtWidgets import QApplication
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.pyqt.book_handler import HandlerDialog
from ebooklib import epub
app = QApplication(sys.argv)
class TestBookHandlerRe... | len(dialog.content_texts) > 0) | self.assertTrue | func_call | tests/test_book_handler_regression.py | test_handler_initialization | TestBookHandlerRegression | 70 | null |
denizsafak/abogen | from abogen.speaker_analysis import analyze_speakers
def _chapters():
return [
{
"id": "0001",
"index": 0,
"title": "Test",
"text": "",
"enabled": True,
}
]
def _chunk(text: str, idx: int) -> dict:
return {
"id": f"chunk-{... | "female" | assert | string_literal | tests/test_speaker_analysis.py | test_analyze_speakers_infers_gender_from_pronouns | 46 | null | |
denizsafak/abogen | import sys
import types
from abogen.webui.conversion_runner import (
_format_spoken_chapter_title,
_headings_equivalent,
_normalize_chapter_opening_caps,
_strip_duplicate_heading_line,
)
def test_strip_duplicate_heading_line_removes_first_match() -> None:
text, removed = _strip_duplicate_heading_l... | "Body text" | assert | string_literal | tests/test_conversion_chapter_titles.py | test_strip_duplicate_heading_line_removes_first_match | 102 | null | |
denizsafak/abogen | from __future__ import annotations
from abogen.webui.conversion_runner import _resolve_voice, _supertonic_voice_from_spec
from abogen.tts_supertonic import DEFAULT_SUPERTONIC_VOICES
def test_resolve_voice_formula_without_pipeline_does_not_crash() -> None:
# This can happen when a previously-saved Kokoro mix formu... | formula | assert | variable | tests/test_voice_formula_resolution.py | test_resolve_voice_formula_without_pipeline_does_not_crash | 12 | null | |
denizsafak/abogen | import unittest
import os
import shutil
import sys
from ebooklib import epub
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from abogen.book_parser import get_book_parser, EpubParser
class TestEpubNcxParsing(unittest.TestCase):
def setUp(self):
self.test_dir = "tests/... | "Chapter 1") | self.assertEqual | string_literal | tests/test_epub_ncx_parsing.py | test_ncx_only_parsing | TestEpubNcxParsing | 83 | null |
denizsafak/abogen | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_feed_exposes_series_metadata() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
xml_payload = """<?xml version=\"1.0\" encoding=\"UTF-8\"?>... | 4.0 | assert | numeric_literal | tests/test_calibre_opds.py | test_calibre_opds_feed_exposes_series_metadata | 35 | null | |
denizsafak/abogen | from abogen.integrations.calibre_opds import (
CalibreOPDSClient,
OPDSEntry,
OPDSFeed,
OPDSLink,
feed_to_dict,
)
def test_calibre_opds_search_filters_by_title_and_author() -> None:
client = CalibreOPDSClient("http://example.com/catalog")
feed = OPDSFeed(
id="catalog",
title=... | ["3"] | assert | collection | tests/test_calibre_opds.py | test_calibre_opds_search_filters_by_title_and_author | 293 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.