diff options
| author | historia <historiavg@proton.me> | 2026-08-19 05:13:36 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-19 05:13:36 -0400 |
| commit | 94ddbb0634022a6e5209b5221c057228ec3d1418 (patch) | |
| tree | d7892e758cad10336816695166c511f7a9689704 /tests/test_chunking.py | |
| parent | 9d4d7ef806c17387af9778725cd65a5e7ed10e39 (diff) | |
| download | tts-audiobook-generator-94ddbb0634022a6e5209b5221c057228ec3d1418.tar.gz | |
feat: reuse one seed per run for consistent voice across chunks
Diffstat (limited to 'tests/test_chunking.py')
| -rw-r--r-- | tests/test_chunking.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_chunking.py b/tests/test_chunking.py index 2062b4e..7f37f80 100644 --- a/tests/test_chunking.py +++ b/tests/test_chunking.py @@ -4,7 +4,7 @@ import unittest from unittest.mock import patch from converter import config -from converter.chunking import split_into_chunks +from converter.chunking import MAX_REQUEST_WORDS, split_into_chunks class ChunkSizeDefaultTests(unittest.TestCase): @@ -14,20 +14,20 @@ class ChunkSizeDefaultTests(unittest.TestCase): chunk size and the hard ceiling must stay well inside that budget.""" def test_default_chunk_size_within_request_ceiling(self): - self.assertLessEqual(config.CHUNK_SIZE_WORDS, config.MAX_REQUEST_WORDS) + self.assertLessEqual(config.CHUNK_SIZE, MAX_REQUEST_WORDS) def test_request_ceiling_within_single_generation_budget(self): - self.assertLessEqual(config.MAX_REQUEST_WORDS, 300) + self.assertLessEqual(MAX_REQUEST_WORDS, 300) def test_sizes_are_positive(self): - self.assertGreaterEqual(config.CHUNK_SIZE_WORDS, 1) - self.assertGreaterEqual(config.MAX_REQUEST_WORDS, 1) + self.assertGreaterEqual(config.CHUNK_SIZE, 1) + self.assertGreaterEqual(MAX_REQUEST_WORDS, 1) class RequestCeilingClampTests(unittest.TestCase): def test_oversized_chunk_size_is_clamped_with_warning(self): text = " ".join(f"word{i}" for i in range(30)) + "." - with patch.object(config, "MAX_REQUEST_WORDS", 10), \ + with patch("converter.chunking.MAX_REQUEST_WORDS", 10), \ self.assertLogs("converter.chunking", level="WARNING") as logs: chunks = split_into_chunks(text, max_words=5000) self.assertTrue(all(len(chunk.split()) <= 10 for chunk in chunks)) @@ -38,7 +38,7 @@ class RequestCeilingClampTests(unittest.TestCase): f"S{i} " + " ".join(["word"] * 8) + "." for i in range(60)) chunks = split_into_chunks(sentences, max_words=5000) self.assertGreater(len(chunks), 1) - self.assertTrue(all(len(chunk.split()) <= config.MAX_REQUEST_WORDS + self.assertTrue(all(len(chunk.split()) <= MAX_REQUEST_WORDS for chunk in chunks)) |
