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
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("2010", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_2000s
TestDateNormalization
113
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_service_processes_job(tmp_path): uploads = tmp_path / "uploads" outputs = tmp_path / "outputs" uploads.mkdir...
"single"
assert
string_literal
tests/test_service.py
test_service_processes_job
70
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) ...
normalized
assert
variable
tests/test_regression_fixes.py
test_footnote_removal
78
null
denizsafak/abogen
import os import sys from pathlib import Path from typing import Iterable import pytest ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT)) def clear_utils_cache(): import abogen.utils as utils getattr(utils.get_user_cache_root, "cache_clear")() yield getattr(utils.get_user_cach...
expected_hf
assert
variable
tests/test_utils_cache.py
test_abogen_temp_dir_configures_hf_cache
53
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...
folded
assert
variable
tests/test_text_normalization.py
test_year_like_numbers_use_common_pronunciation
132
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("I have 1950 apples.", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_ambiguous_numbers
TestDateNormalization
73
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...
"Example"
assert
string_literal
tests/test_opds_import_metadata_mapping.py
test_opds_metadata_overrides_maps_author_and_subtitle
23
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 2")
self.assertEqual
string_literal
tests/test_epub_ncx_parsing.py
test_ncx_only_parsing
TestEpubNcxParsing
84
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", ...
"Example Saga"
assert
string_literal
tests/test_service.py
test_audiobookshelf_metadata_uses_book_number
238
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...
fields
assert
variable
tests/test_audiobookshelf_client.py
test_upload_fields_include_series_sequence
36
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/...
titles)
self.assertIn
variable
tests/test_epub_ncx_parsing.py
test_nested_ncx_parsing
TestEpubNcxParsing
135
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_service_processes_job(tmp_path): uploads = tmp_path / "uploads" outputs = tmp_path / "outputs" uploads.mkdir...
[]
assert
collection
tests/test_service.py
test_service_processes_job
71
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_merges_title_abbreviations() -> None: text = "Dr. Watson met Mr. Holmes at 5 p.m." chunks = c...
1
assert
numeric_literal
tests/test_chunk_helpers.py
test_chunk_text_merges_title_abbreviations
55
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...
"Narrator"
assert
string_literal
tests/test_text_extractor.py
test_epub_metadata_composer_matches_artist
34
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...
filenames
assert
variable
tests/test_debug_tts_samples.py
test_settings_debug_route_writes_manifest
109
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 / "audio"
assert
complex_expr
tests/test_output_paths.py
test_prepare_project_layout_creates_project_subdirs
71
null
denizsafak/abogen
import sys import types from abogen.webui.conversion_runner import _build_outro_text, _build_title_intro_text def test_title_intro_includes_series_sentence() -> None: metadata = { "title": "Galactic Chronicles", "author": "Jane Doe", "series": "Chronicles", "series_index": "2", ...
intro_text
assert
variable
tests/test_conversion_series.py
test_title_intro_includes_series_sentence
78
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...
normalized
assert
variable
tests/test_text_normalization.py
test_title_abbreviations_are_expanded
41
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) ...
"word"
assert
string_literal
tests/test_regression_fixes.py
test_manual_override_normalization
92
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["CUR_001"].lower()
assert
func_call
tests/test_debug_tts_samples.py
test_debug_samples_normalize_smoke
62
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("The battle was in 1066.", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_standard_years
TestDateNormalization
23
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_service_processes_job(tmp_path): uploads = tmp_path / "uploads" outputs = tmp_path / "outputs" uploads.mkdir...
JobStatus.COMPLETED
assert
complex_expr
tests/test_service.py
test_service_processes_job
66
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...
None
assert
none_literal
tests/test_service.py
test_retry_removes_failed_job
201
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...
"Unabridged"
assert
string_literal
tests/test_opds_import_metadata_mapping.py
test_opds_metadata_overrides_maps_author_and_subtitle
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...
"epub")
self.assertEqual
string_literal
tests/test_book_parser.py
test_file_type_property
TestBookParser
212
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="...
False
assert
bool_literal
tests/test_prepare_form.py
test_apply_prepare_form_updates_closing_outro_flag
125
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):...
True)
self.assertTrue
bool_literal
tests/test_epub_missing_file_error_handling.py
test_missing_file_recovery
TestEpubMissingFileErrorHandling
83
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...
nav_doc
assert
variable
tests/test_epub_exporter.py
test_build_epub3_package_handles_missing_markers
119
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_allows_decimal_sequence(tmp_path): source = tmp_path / "book.txt" source.write_text("con...
"4.5"
assert
string_literal
tests/test_service.py
test_audiobookshelf_metadata_allows_decimal_sequence
300
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 1")
self.assertEqual
string_literal
tests/test_epub_html_nav_parsing.py
test_basic_html_nav_parsing
TestEpubHtmlNavParsing
99
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...
content
assert
variable
tests/test_ffmetadata.py
test_render_ffmetadata_includes_chapters
38
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...
"Pages")
self.assertEqual
string_literal
tests/test_pdf_structure.py
test_pdf_structure_without_toc
TestPdfStructure
81
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_...
np.float32
assert
complex_expr
tests/test_tts_supertonic_unsupported_chars.py
test_supertonic_pipeline_strips_unsupported_characters_and_retries
41
null
denizsafak/abogen
from __future__ import annotations from pathlib import Path from abogen.utils import load_config, save_config from abogen.webui.app import create_app def test_settings_update_preserves_abs_api_token_when_blank(tmp_path): # Seed config with stored integration secret. save_config( { "langua...
{302, 303}
assert
collection
tests/test_settings_integrations_secrets.py
test_settings_update_preserves_abs_api_token_when_blank
67
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("It is currently 2023.", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_standard_years
TestDateNormalization
25
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...
"html")
self.assertEqual
string_literal
tests/test_epub_standard_nav.py
test_discovery_by_item_navigation_type
TestEpubStandardNav
95
null
denizsafak/abogen
from __future__ import annotations from pathlib import Path from abogen.utils import load_config, save_config from abogen.webui.app import create_app def test_settings_update_preserves_abs_api_token_when_blank(tmp_path): # Seed config with stored integration secret. save_config( { "langua...
"SECRET_PASS"
assert
string_literal
tests/test_settings_integrations_secrets.py
test_settings_update_preserves_abs_api_token_when_blank
73
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_service_processes_job(tmp_path): uploads = tmp_path / "uploads" outputs = tmp_path / "outputs" uploads.mkdir...
"paragraph"
assert
string_literal
tests/test_service.py
test_service_processes_job
69
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...
{".", "!", "?"}
assert
collection
tests/test_debug_tts_samples.py
test_debug_samples_normalize_smoke
58
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("It happened in 1021 BC.", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_years_with_markers
TestDateNormalization
39
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...
original_nav)
self.assertIsNotNone
variable
tests/test_epub_standard_nav.py
test_discovery_by_nav_property
TestEpubStandardNav
108
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="...
"Blend"
assert
string_literal
tests/test_prepare_form.py
test_resolve_voice_setting_handles_profile_reference
110
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_job_add_log_handles_exception(tmp_path, capsys): sample = tmp_path / "sample.txt" sample.write_text("payload", e...
captured.err
assert
complex_expr
tests/test_service.py
test_job_add_log_handles_exception
154
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...
"7"
assert
string_literal
tests/test_audiobookshelf_client.py
test_upload_fields_include_series_sequence
34
null
denizsafak/abogen
from abogen.integrations.calibre_opds import ( CalibreOPDSClient, OPDSEntry, OPDSFeed, OPDSLink, feed_to_dict, ) def test_calibre_opds_feed_exposes_subtitle_metadata() -> None: client = CalibreOPDSClient("http://example.com/catalog") xml_payload = """<?xml version=\"1.0\" encoding=\"UTF-8\"...
"A Novel"
assert
string_literal
tests/test_calibre_opds.py
test_calibre_opds_feed_exposes_subtitle_metadata
62
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...
parser.content_texts)
self.assertIn
complex_expr
tests/test_book_parser.py
test_epub_parser_content
TestBookParser
141
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("2001", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_2000s
TestDateNormalization
110
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" entry2 = {...
"Only normalized"
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
25
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...
JobStatus.FAILED
assert
complex_expr
tests/test_service.py
test_retry_removes_failed_job
198
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...
"Chapter 1")
self.assertEqual
string_literal
tests/test_epub_content_slicing.py
test_single_file_multiple_chapters
TestEpubContentSlicing
104
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...
"Chapter 2"
assert
string_literal
tests/test_chapter_overrides.py
test_apply_chapter_overrides_uses_original_content_when_text_missing
146
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...
res
assert
variable
tests/test_date_normalization_comprehensive.py
test_addresses_explicit
TestDateNormalization
53
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) ...
"the"
assert
string_literal
tests/test_regression_fixes.py
test_manual_override_normalization
90
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...
1)
self.assertEqual
numeric_literal
tests/test_epub_html_nav_parsing.py
test_span_header_parsing
TestEpubHtmlNavParsing
165
null
denizsafak/abogen
from __future__ import annotations import json from abogen.integrations.audiobookshelf import ( AudiobookshelfClient, AudiobookshelfConfig, ) def test_upload_fields_normalize_alternate_sequence_keys(tmp_path): audio_path = tmp_path / "book.mp3" audio_path.write_bytes(b"audio") config = Audiobook...
"3"
assert
string_literal
tests/test_audiobookshelf_client.py
test_upload_fields_normalize_alternate_sequence_keys
63
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...
{}
assert
collection
tests/test_chapter_overrides.py
test_apply_chapter_overrides_with_custom_text
132
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...
nav_item)
self.assertIsNotNone
variable
tests/test_epub_html_nav_parsing.py
test_identify_nav_item
TestEpubHtmlNavParsing
182
null
denizsafak/abogen
from abogen.integrations.calibre_opds import ( CalibreOPDSClient, OPDSEntry, OPDSFeed, OPDSLink, feed_to_dict, ) def test_calibre_opds_does_not_map_author_into_series_from_categories() -> None: client = CalibreOPDSClient("http://example.com/catalog") xml_payload = """<?xml version=\"1.0\" e...
None
assert
none_literal
tests/test_calibre_opds.py
test_calibre_opds_does_not_map_author_into_series_from_categories
128
null
denizsafak/abogen
from abogen.webui.conversion_runner import _chunk_text_for_tts def test_chunk_text_for_tts_prefers_text_over_normalized_text(): entry = { # Simulate a pre-normalized chunk that lost the asterisk. "normalized_text": "Unfuk", # Raw chunk should preserve censored token for manual overrides. ...
"Unfu*k"
assert
string_literal
tests/test_chunk_text_for_tts_prefers_raw.py
test_chunk_text_for_tts_prefers_text_over_normalized_text
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 class TestEpubContentSlicing(unittest.TestCase): def setUp(self): self.test_dir = "tests/test_dat...
text1)
self.assertIn
variable
tests/test_epub_content_slicing.py
test_single_file_multiple_chapters
TestEpubContentSlicing
111
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_job_add_log_emits_to_stream(tmp_path): sample = tmp_path / "sample.txt" sample.write_text("payload", encoding="u...
"Test log line"
assert
string_literal
tests/test_service.py
test_job_add_log_emits_to_stream
116
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...
{"af_nova", "am_liam"}
assert
collection
tests/test_voice_cache.py
test_ensure_voice_assets_downloads_missing
43
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...
cleaned
assert
variable
tests/test_text_normalization.py
test_all_caps_quotes_are_sentence_cased
165
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="...
"b"
assert
string_literal
tests/test_prepare_form.py
test_resolve_voice_setting_handles_profile_reference
111
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...
original_text
assert
variable
tests/test_epub_exporter.py
test_epub3_preserves_original_whitespace
200
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...
2
assert
numeric_literal
tests/test_ffmetadata.py
test_render_ffmetadata_includes_chapters
27
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...
0)
self.assertGreater
numeric_literal
tests/test_book_parser.py
test_find_position_robust_logic
TestBookParser
173
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=...
[]
assert
collection
tests/test_calibre_opds.py
test_calibre_opds_search_filters_by_title_and_author
296
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("1021", cfg)
assert
func_call
tests/test_date_normalization_comprehensive.py
test_specific_user_examples
TestDateNormalization
78
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...
"Sample Book")
self.assertEqual
string_literal
tests/test_book_parser.py
test_epub_metadata_extraction
TestBookParser
152
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...
"Original"
assert
string_literal
tests/test_chapter_overrides.py
test_merge_metadata_prefers_overrides_and_drops_none_values
192
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["APOS_001"].lower()
assert
func_call
tests/test_debug_tts_samples.py
test_debug_samples_normalize_smoke
49
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="...
"speaker:Female HQ"
assert
string_literal
tests/test_prepare_form.py
test_apply_prepare_form_accepts_saved_speaker_reference_for_voice
89
null
spylang/spy
import textwrap import pytest from spy.backend.spy import FQN_FORMAT, SPyBackend from spy.util import print_diff from spy.vm.vm import SPyVM class TestDoppler: def init(self, tmpdir): # XXX there is a lot of code duplication with CompilerTest self.tmpdir = tmpdir self.vm = SPyVM() ...
4
assert
numeric_literal
spy/tests/test_doppler.py
test_ast_color_map_populated
TestDoppler
374
null
spylang/spy
import pytest from spy.fqn import FQN from spy.tests.support import CompilerTest, no_C from spy.vm.b import B from spy.vm.modules.__spy__.interp_list import W_InterpListType class TestInterpList(CompilerTest): def test_new(self): mod = self.compile(""" from __spy__ import interp_list def...
[1, 2, 3]
assert
collection
spy/tests/compiler/__spy__/test_interp_list.py
test_new
TestInterpList
40
null
spylang/spy
import os from typing import Any, no_type_check import py.path import pytest from spy.util import ( ANYTHING, OrderedSet, cleanup_spyc_files, extend, func_equals, magic_dispatch, shortrepr, ) def test_OrderedSet(): s = OrderedSet[int]() s.add(3) s.add(1) s.add(2) s.add...
[3, 1, 2]
assert
collection
spy/tests/test_util.py
test_OrderedSet
41
null
spylang/spy
import re import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestDynamic(CompilerTest): def test_binop(self): mod = self.compile(""" def add(x: dynamic, y: dynamic) -> dynamic: return x + y def sub(x: dynamic, y: dynamic) -...
4
assert
numeric_literal
spy/tests/compiler/test_dynamic.py
test_binop
TestDynamic
74
null
spylang/spy
from spy.fqn import FQN from spy.tests.support import CompilerTest, only_interp from spy.vm.b import B from spy.vm.modules.__spy__.interp_dict import W_InterpDict from spy.vm.object import W_Type class TestDict(CompilerTest): @only_interp def test_literal_interp_dict(self): mod = self.compile(""" ...
2
assert
numeric_literal
spy/tests/compiler/test_dict.py
test_literal_interp_dict
TestDict
48
null
spylang/spy
from spy.fqn import FQN, NSPart def test_FQN_hash_eq(): a = FQN("aaa::bbb") b = FQN("aaa::bbb") assert a == b assert hash(a) == hash(b) a0 = FQN("aaa::bbb#0") b0 = FQN("aaa::bbb#0") assert a0 ==
b0
assert
variable
spy/tests/test_fqn.py
test_FQN_hash_eq
41
null
spylang/spy
import pytest from spy.errors import SPyError from spy.fqn import FQN from spy.tests.support import ( CompilerTest, expect_errors, no_C, only_interp, skip_backends, ) from spy.vm.b import B class TestMetaFunc(CompilerTest): @no_C def test_COLOR(self): mod = self.compile(""" ...
"blue"
assert
string_literal
spy/tests/compiler/test_metafunc.py
test_COLOR
TestMetaFunc
97
null
spylang/spy
import textwrap from typing import Any import pytest from spy import ast from spy.analyze.scope import ScopeAnalyzer from spy.analyze.symtable import ( Color, ImportRef, Symbol, SymTable, VarKind, VarKindOrigin, VarStorage, ) from spy.fqn import FQN from spy.parser import Parser from spy.t...
{"_list"}
assert
collection
spy/tests/test_scope.py
test_list_literal
TestScopeAnalyzer
665
null
spylang/spy
import textwrap import py.path import pytest from spy import ast from spy.analyze import importing from spy.analyze.importing import SPYC_VERSION, ImportAnalyzer from spy.vm.vm import SPyVM class TestImportAnalyzer: def init(self, tmpdir): self.vm = SPyVM() self.vm.path = [str(tmpdir)] s...
1
assert
numeric_literal
spy/tests/test_import_analyzer.py
test_cache_version_mismatch
TestImportAnalyzer
255
null
spylang/spy
import pytest from spy.tests.support import CompilerTest class TestArray(CompilerTest): def test_len(self): src = """ from array import array def test1() -> int: a = array[int, 1](3) return len(a) def test2() -> int: a = array[int, 2](4, 5) ...
3
assert
numeric_literal
spy/tests/stdlib/test_array.py
test_len
TestArray
51
null
spylang/spy
from spy.fqn_parser import FQN, tokenize def test_two_parts(): fqn = FQN("mod::foo") assert len(fqn.parts) ==
2
assert
numeric_literal
spy/tests/test_fqn_parser.py
test_two_parts
21
null
spylang/spy
from typing import Any from spy.tests.support import CompilerTest, no_C from spy.vm.builtin import builtin_method from spy.vm.opspec import W_MetaArg, W_OpSpec from spy.vm.primitive import W_I32 from spy.vm.registry import ModuleRegistry from spy.vm.vm import SPyVM from spy.vm.w import W_Object class TestOperatorBino...
7
assert
numeric_literal
spy/tests/compiler/operator/test_binop.py
test_sub
TestOperatorBinop
187
null
spylang/spy
import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, expect_errors, only_C, only_interp from spy.tests.wasm_wrapper import WasmPtr from spy.vm.b import B from spy.vm.modules.unsafe import UNSAFE from spy.vm.modules.unsafe.ptr import W_Ptr def memkind(request): return request.p...
0
assert
numeric_literal
spy/tests/compiler/unsafe/test_ptr.py
test_ptr_NULL
TestUnsafePtr
376
null
spylang/spy
from spy.fqn_parser import FQN, tokenize def test_single_part_with_qualifier(): fqn = FQN("list[i32]") assert len(fqn.parts) == 1 assert fqn.parts[0].name == "list" assert len(fqn.parts[0].qualifiers) == 1 assert fqn.parts[0].qualifiers[0].parts[0].name ==
"i32"
assert
string_literal
spy/tests/test_fqn_parser.py
test_single_part_with_qualifier
42
null
spylang/spy
import re import subprocess import sys import textwrap from subprocess import getstatusoutput from typing import Any import pytest from typer.testing import CliRunner import spy from spy.cli import app PYODIDE_EXE = spy.ROOT.dirpath().join("pyodide", "venv", "bin", "python") ANSI_ESCAPE = re.compile( r""" \...
1
assert
numeric_literal
spy/tests/test_cli.py
test_py_file_error
TestMain
130
null
spylang/spy
import pytest from spy.tests.support import CompilerTest, expect_errors, no_C, only_interp from spy.vm.builtin import builtin_method from spy.vm.opspec import W_MetaArg, W_OpSpec from spy.vm.primitive import W_I32, W_Dynamic from spy.vm.registry import ModuleRegistry from spy.vm.vm import SPyVM from spy.vm.w import W_...
0
assert
numeric_literal
spy/tests/compiler/test_builtins.py
test_len
TestBuiltins
72
null
spylang/spy
from typing import Annotated import pytest from spy.errors import SPyError from spy.fqn import FQN from spy.vm.b import B from spy.vm.builtin import ( builtin_class_attr, builtin_method, builtin_type, functype_from_sig, ) from spy.vm.object import W_Object from spy.vm.primitive import W_I32, W_Dynamic...
w_y
assert
variable
spy/tests/vm/test_builtin.py
test_blue
TestBuiltin
120
null
spylang/spy
from spy.tests.support import CompilerTest class TestDunderSpy(CompilerTest): def test_is_compiled(self): mod = self.compile(""" from __spy__ import is_compiled def foo() -> bool: return is_compiled() """) if self.backend in ("interp", "doppler"): as...
True
assert
bool_literal
spy/tests/compiler/test_dunder_spy.py
test_is_compiled
TestDunderSpy
15
null
spylang/spy
import pytest from spy.errors import SPyError from spy.fqn import FQN from spy.tests.support import ( CompilerTest, expect_errors, no_C, only_interp, skip_backends, ) from spy.vm.b import B class TestMetaFunc(CompilerTest): @no_C def test_STATIC_TYPE(self): mod = self.compile(""" ...
B.w_i32
assert
complex_expr
spy/tests/compiler/test_metafunc.py
test_STATIC_TYPE
TestMetaFunc
81
null
spylang/spy
import pytest from spy.tests.support import CompilerTest, expect_errors, no_C, only_interp from spy.vm.builtin import builtin_method from spy.vm.opspec import W_MetaArg, W_OpSpec from spy.vm.primitive import W_I32, W_Dynamic from spy.vm.registry import ModuleRegistry from spy.vm.vm import SPyVM from spy.vm.w import W_...
7
assert
numeric_literal
spy/tests/compiler/test_builtins.py
test_setattr
TestBuiltins
227
null
spylang/spy
import struct from spy.libspy import LLSPyInstance, SPyError from spy.llwasm import LLWasmModule from spy.tests.support import CTest def mk_spy_Str(utf8: bytes) -> bytes: """ Return the spy_Str representation of the given utf8 bytes. For example, for b'hello' we have the following in-memory repr: ...
mk_spy_Str(b"world")
assert
func_call
spy/tests/test_libspy.py
test_str
TestLibSPy
65
null
spylang/spy
import re import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestDynamic(CompilerTest): def test_bitwise(self): mod = self.compile(""" def shl(x: dynamic, y: dynamic) -> dynamic: return x << y def shr(x: dynamic, y: dynamic) ->...
7 & 3
assert
complex_expr
spy/tests/compiler/test_dynamic.py
test_bitwise
TestDynamic
90
null
spylang/spy
import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, expect_errors, only_C, only_interp from spy.tests.wasm_wrapper import WasmPtr from spy.vm.b import B from spy.vm.modules.unsafe import UNSAFE from spy.vm.modules.unsafe.ptr import W_Ptr def memkind(request): return request.p...
d1
assert
variable
spy/tests/compiler/unsafe/test_ptr.py
test_dir
TestUnsafePtr
169
null
spylang/spy
import textwrap import pytest from spy.textbuilder import ColorFormatter, TextBuilder class TestColorFormatter: def test_color_contextmanager(self): b = TextBuilder(use_colors=True) # Basic color context with b.color("red"): b.write("red text") b.writeline() ...
s
assert
variable
spy/tests/test_textbuilder.py
test_color_contextmanager
TestColorFormatter
263
null
spylang/spy
import pytest from spy.tests.support import CompilerTest, expect_errors, no_C, only_interp from spy.vm.builtin import builtin_method from spy.vm.opspec import W_MetaArg, W_OpSpec from spy.vm.primitive import W_I32, W_Dynamic from spy.vm.registry import ModuleRegistry from spy.vm.vm import SPyVM from spy.vm.w import W_...
3
assert
numeric_literal
spy/tests/compiler/test_builtins.py
test_getattr
TestBuiltins
173
null
spylang/spy
from spy.tests.support import CompilerTest, expect_errors, only_interp from spy.vm.b import B from spy.vm.opimpl import W_OpImpl from spy.vm.opspec import W_MetaArg, W_OpSpec class TestOpSpec(CompilerTest): def test_new_MetaArg(self): mod = self.compile(""" from operator import MetaArg @b...
B.w_i32
assert
complex_expr
spy/tests/compiler/test_opspec.py
test_new_MetaArg
TestOpSpec
70
null
spylang/spy
import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest class TestList(CompilerTest): def test_basic_operations(self): src = """ from _list import list def test_empty() -> int: lst = list[int]() return len(lst) def test_app...
3
assert
numeric_literal
spy/tests/stdlib/test__list.py
test_basic_operations
TestList
25
null