Restructured tests, fixed support for python 3.13, updated to latest audio-separator and numpy etc.

This commit is contained in:
Andrew Beveridge committed 2025-06-29 16:36:59 -04:00
1 parent 9599dd595e
commit 9169e5b4a7
45 files changed
+1003 -755

No files matched your search

+3 -3
View File
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
python-version: ['3.13']
steps:
- uses: actions/checkout@v3
@@ -38,7 +38,7 @@ jobs:
- name: Run unit tests
run: |
poetry run pytest tests/unit/ -v --cov=karaoke_prep --cov-report=xml --cov-report=term-missing --cov-fail-under=80
poetry run pytest tests/unit/ -v --cov=karaoke_gen --cov-report=xml --cov-report=term-missing --cov-fail-under=80
- name: Upload coverage reports
uses: codecov/codecov-action@v5
@@ -59,7 +59,7 @@ jobs:
- name: Test package installation
run: |
pip install dist/*.whl
python -m karaoke_prep.utils.gen_cli --help
python -m karaoke_gen.utils.gen_cli --help
publish:
needs: test
+19
View File
@@ -95,6 +95,25 @@ For a complete list of options:
karaoke-gen --help
```
## Development
### Running Tests
The project uses pytest for testing with unit and integration tests:
```bash
# Run all tests (unit tests first, then integration tests)
pytest
# Run only unit tests (fast feedback during development)
pytest -m "not integration"
# Run only integration tests (comprehensive end-to-end testing)
pytest -m integration
```
Unit tests run quickly and provide fast feedback, while integration tests are slower but test the full workflow end-to-end.
## License
MIT
+7
View File
@@ -0,0 +1,7 @@
import warnings
# Suppress specific SyntaxWarnings from third-party packages
warnings.filterwarnings("ignore", category=SyntaxWarning, module="pydub.*")
warnings.filterwarnings("ignore", category=SyntaxWarning, module="syrics.*")
from .karaoke_gen import KaraokePrep
@@ -187,7 +187,7 @@ class AudioProcessor:
stems_dir = self._create_stems_directory(track_output_dir)
result = {"clean_instrumental": {}, "other_stems": {}, "backing_vocals": {}, "combined_instrumentals": {}}
if os.environ.get("KARAOKE_PREP_SKIP_AUDIO_SEPARATION"):
if os.environ.get("KARAOKE_GEN_SKIP_AUDIO_SEPARATION"):
return result
result["clean_instrumental"] = self._separate_clean_instrumental(
File renamed without changes.
File renamed without changes.
@@ -501,7 +501,7 @@ class KaraokePrep:
processed_track["title_video"] = os.path.join(track_output_dir, f"{artist_title} (Title).mov")
# Use FileHandler._file_exists
if not self.file_handler._file_exists(processed_track["title_video"]) and not os.environ.get("KARAOKE_PREP_SKIP_TITLE_END_SCREENS"):
if not self.file_handler._file_exists(processed_track["title_video"]) and not os.environ.get("KARAOKE_GEN_SKIP_TITLE_END_SCREENS"):
self.logger.info(f"Creating title video...")
# Delegate to VideoGenerator
self.video_generator.create_title_video(
@@ -520,7 +520,7 @@ class KaraokePrep:
processed_track["end_video"] = os.path.join(track_output_dir, f"{artist_title} (End).mov")
# Use FileHandler._file_exists
if not self.file_handler._file_exists(processed_track["end_video"]) and not os.environ.get("KARAOKE_PREP_SKIP_TITLE_END_SCREENS"):
if not self.file_handler._file_exists(processed_track["end_video"]) and not os.environ.get("KARAOKE_GEN_SKIP_TITLE_END_SCREENS"):
self.logger.info(f"Creating end screen video...")
# Delegate to VideoGenerator
self.video_generator.create_end_video(
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -7,8 +7,8 @@ import csv
import asyncio
import json
import sys
from karaoke_prep import KaraokePrep
from karaoke_prep.karaoke_finalise import KaraokeFinalise
from karaoke_gen import KaraokePrep
from karaoke_gen.karaoke_finalise import KaraokeFinalise
# Global logger
logger = logging.getLogger(__name__)
@@ -1,10 +1,4 @@
#!/usr/bin/env python
import warnings
# Suppress specific SyntaxWarnings from third-party packages
warnings.filterwarnings("ignore", category=SyntaxWarning, module="pydub.*")
warnings.filterwarnings("ignore", category=SyntaxWarning, module="syrics.*")
import argparse
import logging
from importlib import metadata
@@ -15,8 +9,8 @@ import json
import asyncio
import time
import pyperclip
from karaoke_prep import KaraokePrep
from karaoke_prep.karaoke_finalise import KaraokeFinalise
from karaoke_gen import KaraokePrep
from karaoke_gen.karaoke_finalise import KaraokeFinalise
def is_url(string):
@@ -644,8 +638,8 @@ async def async_main():
# Set up environment variables for lyrics-only mode
if args.lyrics_only:
args.skip_separation = True
os.environ["KARAOKE_PREP_SKIP_AUDIO_SEPARATION"] = "1"
os.environ["KARAOKE_PREP_SKIP_TITLE_END_SCREENS"] = "1"
os.environ["KARAOKE_GEN_SKIP_AUDIO_SEPARATION"] = "1"
os.environ["KARAOKE_GEN_SKIP_TITLE_END_SCREENS"] = "1"
logger.info("Lyrics-only mode enabled: skipping audio separation and title/end screen generation")
# Step 1: Run KaraokePrep
@@ -71,7 +71,7 @@ class VideoGenerator:
else:
# Try to load from package resources
try:
with pkg_resources.path("karaoke_prep.resources", format["font"]) as font_path:
with pkg_resources.path("karaoke_gen.resources", format["font"]) as font_path:
font_path = str(font_path)
except Exception as e:
self.logger.warning(f"Could not load font from resources: {e}, falling back to default font")
-1
View File
@@ -1 +0,0 @@
from .karaoke_prep import KaraokePrep
Generated
+366 -141
View File
@@ -136,17 +136,18 @@ tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" a
[[package]]
name = "audio-separator"
version = "0.30.2"
version = "0.34.1"
description = "Easy to use audio stem separation, using various models from UVR trained primarily by @Anjok07"
optional = false
python-versions = ">=3.10"
groups = ["main"]
files = [
{file = "audio_separator-0.30.2-py3-none-any.whl", hash = "sha256:6cbb9d775fca421090614a77b03814f964f083ec898154ae144351ac2ba4de2b"},
{file = "audio_separator-0.30.2.tar.gz", hash = "sha256:f21830071a3568a5a57e6fbf9a9e207cd1eb381b4170052835916877d1cecbb4"},
{file = "audio_separator-0.34.1-py3-none-any.whl", hash = "sha256:20a748d16046313f999545bc340b18e9673f8cff775dac10c65ddd3df3c4ee15"},
{file = "audio_separator-0.34.1.tar.gz", hash = "sha256:13229ae6ee1b2579f64cc070141bf1b4a6c67ac3522a76e7633b3f4d1cd76ece"},
]
[package.dependencies]
audioop-lts = {version = ">=0.2.1", markers = "python_version >= \"3.13\" and python_version < \"4.0\""}
beartype = ">=0.18.5,<0.19.0"
diffq = {version = ">=0.2", markers = "sys_platform != \"win32\""}
diffq-fixed = {version = ">=0.2", markers = "sys_platform == \"win32\""}
@@ -154,9 +155,9 @@ einops = ">=0.7"
julius = ">=0.2"
librosa = ">=0.10"
ml_collections = "*"
numpy = ">=1.23,<2"
onnx = ">=1.14"
onnx2torch = ">=1.5"
numpy = ">=2"
onnx-weekly = "*"
onnx2torch-py313 = ">=1.6"
onnxruntime = {version = ">=1.17", optional = true, markers = "extra == \"cpu\""}
pydub = ">=0.25"
pyyaml = "*"
@@ -171,8 +172,53 @@ tqdm = "*"
[package.extras]
cpu = ["onnxruntime (>=1.17)"]
dml = ["onnxruntime-directml (>=1.17)", "torch_directml"]
gpu = ["onnxruntime-gpu (>=1.17)"]
[[package]]
name = "audioop-lts"
version = "0.2.1"
description = "LTS Port of Python audioop"
optional = false
python-versions = ">=3.13"
groups = ["main"]
markers = "python_version == \"3.13\""
files = [
{file = "audioop_lts-0.2.1-cp313-abi3-macosx_10_13_universal2.whl", hash = "sha256:fd1345ae99e17e6910f47ce7d52673c6a1a70820d78b67de1b7abb3af29c426a"},
{file = "audioop_lts-0.2.1-cp313-abi3-macosx_10_13_x86_64.whl", hash = "sha256:e175350da05d2087e12cea8e72a70a1a8b14a17e92ed2022952a4419689ede5e"},
{file = "audioop_lts-0.2.1-cp313-abi3-macosx_11_0_arm64.whl", hash = "sha256:4a8dd6a81770f6ecf019c4b6d659e000dc26571b273953cef7cd1d5ce2ff3ae6"},
{file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d1cd3c0b6f2ca25c7d2b1c3adeecbe23e65689839ba73331ebc7d893fcda7ffe"},
{file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff3f97b3372c97782e9c6d3d7fdbe83bce8f70de719605bd7ee1839cd1ab360a"},
{file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a351af79edefc2a1bd2234bfd8b339935f389209943043913a919df4b0f13300"},
{file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2aeb6f96f7f6da80354330470b9134d81b4cf544cdd1c549f2f45fe964d28059"},
{file = "audioop_lts-0.2.1-cp313-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c589f06407e8340e81962575fcffbba1e92671879a221186c3d4662de9fe804e"},
{file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:fbae5d6925d7c26e712f0beda5ed69ebb40e14212c185d129b8dfbfcc335eb48"},
{file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_i686.whl", hash = "sha256:d2d5434717f33117f29b5691fbdf142d36573d751716249a288fbb96ba26a281"},
{file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:f626a01c0a186b08f7ff61431c01c055961ee28769591efa8800beadd27a2959"},
{file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_s390x.whl", hash = "sha256:05da64e73837f88ee5c6217d732d2584cf638003ac72df124740460531e95e47"},
{file = "audioop_lts-0.2.1-cp313-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:56b7a0a4dba8e353436f31a932f3045d108a67b5943b30f85a5563f4d8488d77"},
{file = "audioop_lts-0.2.1-cp313-abi3-win32.whl", hash = "sha256:6e899eb8874dc2413b11926b5fb3857ec0ab55222840e38016a6ba2ea9b7d5e3"},
{file = "audioop_lts-0.2.1-cp313-abi3-win_amd64.whl", hash = "sha256:64562c5c771fb0a8b6262829b9b4f37a7b886c01b4d3ecdbae1d629717db08b4"},
{file = "audioop_lts-0.2.1-cp313-abi3-win_arm64.whl", hash = "sha256:c45317debeb64002e980077642afbd977773a25fa3dfd7ed0c84dccfc1fafcb0"},
{file = "audioop_lts-0.2.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:3827e3fce6fee4d69d96a3d00cd2ab07f3c0d844cb1e44e26f719b34a5b15455"},
{file = "audioop_lts-0.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:161249db9343b3c9780ca92c0be0d1ccbfecdbccac6844f3d0d44b9c4a00a17f"},
{file = "audioop_lts-0.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5b7b4ff9de7a44e0ad2618afdc2ac920b91f4a6d3509520ee65339d4acde5abf"},
{file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:72e37f416adb43b0ced93419de0122b42753ee74e87070777b53c5d2241e7fab"},
{file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:534ce808e6bab6adb65548723c8cbe189a3379245db89b9d555c4210b4aaa9b6"},
{file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d2de9b6fb8b1cf9f03990b299a9112bfdf8b86b6987003ca9e8a6c4f56d39543"},
{file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f24865991b5ed4b038add5edbf424639d1358144f4e2a3e7a84bc6ba23e35074"},
{file = "audioop_lts-0.2.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bdb3b7912ccd57ea53197943f1bbc67262dcf29802c4a6df79ec1c715d45a78"},
{file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:120678b208cca1158f0a12d667af592e067f7a50df9adc4dc8f6ad8d065a93fb"},
{file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:54cd4520fc830b23c7d223693ed3e1b4d464997dd3abc7c15dce9a1f9bd76ab2"},
{file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:d6bd20c7a10abcb0fb3d8aaa7508c0bf3d40dfad7515c572014da4b979d3310a"},
{file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:f0ed1ad9bd862539ea875fb339ecb18fcc4148f8d9908f4502df28f94d23491a"},
{file = "audioop_lts-0.2.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e1af3ff32b8c38a7d900382646e91f2fc515fd19dea37e9392275a5cbfdbff63"},
{file = "audioop_lts-0.2.1-cp313-cp313t-win32.whl", hash = "sha256:f51bb55122a89f7a0817d7ac2319744b4640b5b446c4c3efcea5764ea99ae509"},
{file = "audioop_lts-0.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:f0f2f336aa2aee2bce0b0dcc32bbba9178995454c7b979cf6ce086a8801e14c7"},
{file = "audioop_lts-0.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:78bfb3703388c780edf900be66e07de5a3d4105ca8e8720c5c4d67927e0b15d0"},
{file = "audioop_lts-0.2.1.tar.gz", hash = "sha256:e81268da0baa880431b68b1308ab7257eb33f356e57a5f9b1f915dfb13dd1387"},
]
[[package]]
name = "audioread"
version = "3.0.1"
@@ -296,40 +342,49 @@ uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "blis"
version = "1.2.1"
version = "1.3.0"
description = "The Blis BLAS-like linear algebra library, as a self-contained C-extension."
optional = false
python-versions = "<3.13,>=3.6"
python-versions = "<3.14,>=3.6"
groups = ["main"]
files = [
{file = "blis-1.2.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:112443b90698158ada38f71e74c079c3561e802554a51e9850d487c39db25de0"},
{file = "blis-1.2.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b9f8c4fbc303f47778d1fd47916cae785b6f3beaa2031502112a8c0aa5eb29f6"},
{file = "blis-1.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0260ecbbaa890f11d8c88e9ce37d4fc9a91839adc34ba1763ba89424362e54c9"},
{file = "blis-1.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2b70e0693564444b608d765727ab31618de3b92c5f203b9dc6b6a108170a8cea"},
{file = "blis-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67ae48f73828cf38f65f24b6c6d8ec16f22c99820e0d13e7d97370682fdb023d"},
{file = "blis-1.2.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9eff1af9b142fd156a7b83f513061f2e464c4409afb37080fde436e969951703"},
{file = "blis-1.2.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:d05f07fd37b407edb294322d3b2991b0950a61123076cc380d3e9c3deba77c83"},
{file = "blis-1.2.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8d5abc324180918a4d7ef81f31c37907d13e85f2831317cba3edacd4ef9b7d39"},
{file = "blis-1.2.1-cp310-cp310-win_amd64.whl", hash = "sha256:8de9a1e536202064b57c60d09ff0886275b50c5878df6d58fb49c731eaf535a7"},
{file = "blis-1.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:778c4f72b71f97187e3304acfbd30eab98c9ba1a5b03b65128bc3875400ae604"},
{file = "blis-1.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5c5f2ffb0ae9c1f5aaa95b9681bcdd9a777d007c501fa220796329b939ca2790"},
{file = "blis-1.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:db4dc5d2d57106bb411633603a5c7d178a0845267c3efc7e5ea4fa7a44772976"},
{file = "blis-1.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c621271c2843101927407e052b35a67f853da59d5c74e9e070e982c7f82e2e04"},
{file = "blis-1.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:43f65f882250b817566d7543abd1f6da297f1662e5dd9936e14c04b88285a497"},
{file = "blis-1.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:78a0613d559ccc426c101c67e8f84e1f93491e29d722c370872c538ee652bd07"},
{file = "blis-1.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:2f5e32e5e5635fc7087b724b53120dbcd86201f56c0405882ce254bc0e493392"},
{file = "blis-1.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d339c97cc83f53e39c1013d0dcd7d5278c853dc102d931132eeb05b226e28429"},
{file = "blis-1.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:8d284323cc994e9b818c32046f1aa3e57bcc41c74e02daebdf0d3bc3e14355cb"},
{file = "blis-1.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:1cd35e94a1a97b37b31b11f097f998a3a0e75ac06d57e6edf7d9597200f55756"},
{file = "blis-1.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7b6394d27f2259c580df8d13ebe9c0a188a6ace0a689e93d6e49cb15018d4d9c"},
{file = "blis-1.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a9c127159415dc772f345abc3575e1e2d02bb1ae7cb7f532267d67705be04c66"},
{file = "blis-1.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5f9fa589aa72448009fd5001afb05e69f3bc953fe778b44580fd7d79ee8201a1"},
{file = "blis-1.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1aa6150259caf4fa0b527bfc8c1e858542f9ca88a386aa90b93e1ca4c2add6df"},
{file = "blis-1.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3ba67c09883cae52da3d9e9d3f4305464efedd336032c4d5c6c429b27b16f4c1"},
{file = "blis-1.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:7d9c5fca21b01c4b2f3cb95b71ce7ef95e58b3b62f0d79d1f699178c72c1e03e"},
{file = "blis-1.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:6952a4a1f15e0d1f73cc1206bd71368b32551f2e94852dae288b50c4ea0daf31"},
{file = "blis-1.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:bd0360427b1669684cd35a8355be126d7a33992ccac6dcb1fbef5e100f4e3026"},
{file = "blis-1.2.1.tar.gz", hash = "sha256:1066beedbedc2143c22bd28742658de05694afebacde8d8c2d14dd4b5a96765a"},
{file = "blis-1.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:03c5d2d59415c58ec60e16a0d35d6516a50dae8f17963445845fd961530fcfb0"},
{file = "blis-1.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d1b5c7e7b337e4b0b4887d4837c25e787a940c38d691c6b2936baebf1d008f1b"},
{file = "blis-1.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f446f853e755e71e7abb9b23ad25fe36f7e3dc6a88ba3e071a06dedd029fb5dc"},
{file = "blis-1.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7c9448cd77af47afbecaf0267168016b76298553cc46e51c1c00c22256df21c7"},
{file = "blis-1.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb2571616da1dfa4a927f2952ae90afc7b061f287da47a0a1bd8318c3a53e178"},
{file = "blis-1.3.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9995848456a3684a81585e1d19e7315023614cff9e52ae292129ad600117d7d9"},
{file = "blis-1.3.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:520a21fea2355bce4a103893b13c581ecb7034547d4d71d22f7033419c6ace75"},
{file = "blis-1.3.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:5cb979397cb69ecffe7a67614dd044de0c43486348e1591d1cf77f425c1eb7bd"},
{file = "blis-1.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:2cbc7b6997be35d94e004587eaf211ca187e4013f9a2df0bb949f3dfba18c68c"},
{file = "blis-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:456833a6006dce2165d68e1ab0aa7678608a9a99a18aa37af7aa0437c972f7f6"},
{file = "blis-1.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8072fbb03505444c818810536ad77616a18d97bbde06e8ec69755d917abb7f31"},
{file = "blis-1.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:594c2332bcb1a0fdacb5e857a1afaf338d52c05ba24710515cddbf25862787ac"},
{file = "blis-1.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2cf336a810bd0e6ab52e8ba5455c42ff02f6216acb196ffc831cd30ab084127e"},
{file = "blis-1.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cad91ae2c8a11286b32e80ac7e579d7028f8c0a22afa1e817edddc18051f05b2"},
{file = "blis-1.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1bf4267616fb97a3b869cc8d278383faa86882dc8330067421f9bf9c06e6b80c"},
{file = "blis-1.3.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:45c6f6e801c712592f487f4021c9a85079d6ff8fc487f3d8202212edd4900f8e"},
{file = "blis-1.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:570113bc81bce8890fa2c067a30f6e6caa82bb3be7de0926d659e986e40f5509"},
{file = "blis-1.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:75ecaa548589cba2ba75e621e2a8b89888e3f326ef1a27e7a9b1713114467ff2"},
{file = "blis-1.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ef188f1f914d52acbbd75993ba25554e381ec9099758b340cd0da41af94ae8ae"},
{file = "blis-1.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:626f84522faa51d5a52f9820551a84a5e02490bf6d1abdfc8d27934a0ff939de"},
{file = "blis-1.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f56e0454ce44bc08797383ce427ee5e2b044aab1eafb450eab82e86f8bfac853"},
{file = "blis-1.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c9bb5770efe233374d73a567af5cdef24f48bead83d118bdb9bd5c2187b0f010"},
{file = "blis-1.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d52ce33a1895d82f2f39f7689d5e70b06ebba6bc6f610046ecd81db88d650aac"},
{file = "blis-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6c78e8dd420e0e695df0ceecf950f3cf823e0a1b8c2871a7e35117c744d45861"},
{file = "blis-1.3.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:7a060700ee98ea44a1b9833b16d3dd1375aaa9d3230222bfc5f13c4664e5710e"},
{file = "blis-1.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:250f0b0aeca0fdde7117751a54ae6d6b6818a446a619f3c0c63f3deb77f700a8"},
{file = "blis-1.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:2e6f468467a18a7c2ac2e411643f5cfa45a435701e2c04ad4aa46bb02fc3aa5c"},
{file = "blis-1.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4d6a91c8726d0bc3345a8e0c8b7b8e800bee0b9acc4c2a0dbeb782b8b651f824"},
{file = "blis-1.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e3c20bc3d7143383195cc472373fb301d3bafbacd8ab8f3bffc27c68bef45d81"},
{file = "blis-1.3.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:778c4b84c6eccab223d8afe20727820f6c7dd7a010c3bfb262104cc83b0a8e4c"},
{file = "blis-1.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:69584589977366366cd99cc7cb23a76a814df8bcae8b777fde4a94e8684c1fb8"},
{file = "blis-1.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b2adc4549e610b59e8db5a57ab7206e4ac1502ac5b261ed0e6de42d3fb311d5"},
{file = "blis-1.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:9aaa84df638e0bb7909a35e3c220168df2b90f267967b3004a88f57b49fbe4ec"},
{file = "blis-1.3.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:0da7b54331bed31aa55839da2d0e5451447e1f5e8a9367cce7ff1fb27498a22a"},
{file = "blis-1.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:682175bf2d047129b3715e3f1305c6b23a45e2ce24c4b1d0fa2eb03eb877edd4"},
{file = "blis-1.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:91de2baf03da3a173cf62771f1d6b9236a27a8cbd0e0033be198f06ef6224986"},
{file = "blis-1.3.0.tar.gz", hash = "sha256:1695a87e3fc4c20d9b9140f5238cac0514c411b750e8cdcec5d8320c71f62e99"},
]
[package.dependencies]
@@ -1590,7 +1645,10 @@ files = [
[package.dependencies]
google-auth = ">=2.14.1,<3.0.0"
googleapis-common-protos = ">=1.56.2,<2.0.0"
proto-plus = ">=1.22.3,<2.0.0"
proto-plus = [
{version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""},
{version = ">=1.22.3,<2.0.0", markers = "python_version < \"3.13\""},
]
protobuf = ">=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<7.0.0"
requests = ">=2.18.0,<3.0.0"
@@ -2414,6 +2472,8 @@ scikit-learn = ">=1.1.0"
scipy = ">=1.6.0"
soundfile = ">=0.12.1"
soxr = ">=0.3.2"
standard-aifc = {version = "*", markers = "python_version >= \"3.13\""}
standard-sunau = {version = "*", markers = "python_version >= \"3.13\""}
typing_extensions = ">=4.1.1"
[package.extras]
@@ -3071,6 +3131,7 @@ description = "Python package for creating and manipulating graphs and networks"
optional = false
python-versions = ">=3.10"
groups = ["main"]
markers = "python_version < \"3.13\""
files = [
{file = "networkx-3.4.2-py3-none-any.whl", hash = "sha256:df5d4365b724cf81b8c6a7312509d0c22386097011ad1abe274afd5e9d3bbc5f"},
{file = "networkx-3.4.2.tar.gz", hash = "sha256:307c3669428c5362aab27c8a1260aa8f47c4e91d3891f48be0141738d8d053e1"},
@@ -3084,6 +3145,28 @@ example = ["cairocffi (>=1.7)", "contextily (>=1.6)", "igraph (>=0.11)", "momepy
extra = ["lxml (>=4.6)", "pydot (>=3.0.1)", "pygraphviz (>=1.14)", "sympy (>=1.10)"]
test = ["pytest (>=7.2)", "pytest-cov (>=4.0)"]
[[package]]
name = "networkx"
version = "3.5"
description = "Python package for creating and manipulating graphs and networks"
optional = false
python-versions = ">=3.11"
groups = ["main"]
markers = "python_version == \"3.13\""
files = [
{file = "networkx-3.5-py3-none-any.whl", hash = "sha256:0030d386a9a06dee3565298b4a734b68589749a544acbb6c412dc9e2489ec6ec"},
{file = "networkx-3.5.tar.gz", hash = "sha256:d4c6f9cf81f52d69230866796b82afbccdec3db7ae4fbd1b65ea750feed50037"},
]
[package.extras]
default = ["matplotlib (>=3.8)", "numpy (>=1.25)", "pandas (>=2.0)", "scipy (>=1.11.2)"]
developer = ["mypy (>=1.15)", "pre-commit (>=4.1)"]
doc = ["intersphinx-registry", "myst-nb (>=1.1)", "numpydoc (>=1.8.0)", "pillow (>=10)", "pydata-sphinx-theme (>=0.16)", "sphinx (>=8.0)", "sphinx-gallery (>=0.18)", "texext (>=0.6.7)"]
example = ["cairocffi (>=1.7)", "contextily (>=1.6)", "igraph (>=0.11)", "momepy (>=0.7.2)", "osmnx (>=2.0.0)", "scikit-learn (>=1.5)", "seaborn (>=0.13)"]
extra = ["lxml (>=4.6)", "pydot (>=3.0.1)", "pygraphviz (>=1.14)", "sympy (>=1.10)"]
test = ["pytest (>=7.2)", "pytest-cov (>=4.0)", "pytest-xdist (>=3.0)"]
test-extras = ["pytest-mpl", "pytest-randomly"]
[[package]]
name = "nltk"
version = "3.9.1"
@@ -3147,48 +3230,67 @@ numpy = ">=1.24,<2.3"
[[package]]
name = "numpy"
version = "1.26.4"
version = "2.2.6"
description = "Fundamental package for array computing in Python"
optional = false
python-versions = ">=3.9"
python-versions = ">=3.10"
groups = ["main"]
files = [
{file = "numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0"},
{file = "numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a"},
{file = "numpy-1.26.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4"},
{file = "numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"},
{file = "numpy-1.26.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a"},
{file = "numpy-1.26.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2"},
{file = "numpy-1.26.4-cp310-cp310-win32.whl", hash = "sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07"},
{file = "numpy-1.26.4-cp310-cp310-win_amd64.whl", hash = "sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5"},
{file = "numpy-1.26.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71"},
{file = "numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef"},
{file = "numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e"},
{file = "numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5"},
{file = "numpy-1.26.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a"},
{file = "numpy-1.26.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a"},
{file = "numpy-1.26.4-cp311-cp311-win32.whl", hash = "sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20"},
{file = "numpy-1.26.4-cp311-cp311-win_amd64.whl", hash = "sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2"},
{file = "numpy-1.26.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218"},
{file = "numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b"},
{file = "numpy-1.26.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b"},
{file = "numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed"},
{file = "numpy-1.26.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a"},
{file = "numpy-1.26.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0"},
{file = "numpy-1.26.4-cp312-cp312-win32.whl", hash = "sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110"},
{file = "numpy-1.26.4-cp312-cp312-win_amd64.whl", hash = "sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818"},
{file = "numpy-1.26.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c"},
{file = "numpy-1.26.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be"},
{file = "numpy-1.26.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764"},
{file = "numpy-1.26.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3"},
{file = "numpy-1.26.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd"},
{file = "numpy-1.26.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c"},
{file = "numpy-1.26.4-cp39-cp39-win32.whl", hash = "sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6"},
{file = "numpy-1.26.4-cp39-cp39-win_amd64.whl", hash = "sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea"},
{file = "numpy-1.26.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30"},
{file = "numpy-1.26.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c"},
{file = "numpy-1.26.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0"},
{file = "numpy-1.26.4.tar.gz", hash = "sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010"},
{file = "numpy-2.2.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b412caa66f72040e6d268491a59f2c43bf03eb6c96dd8f0307829feb7fa2b6fb"},
{file = "numpy-2.2.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e41fd67c52b86603a91c1a505ebaef50b3314de0213461c7a6e99c9a3beff90"},
{file = "numpy-2.2.6-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:37e990a01ae6ec7fe7fa1c26c55ecb672dd98b19c3d0e1d1f326fa13cb38d163"},
{file = "numpy-2.2.6-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:5a6429d4be8ca66d889b7cf70f536a397dc45ba6faeb5f8c5427935d9592e9cf"},
{file = "numpy-2.2.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:efd28d4e9cd7d7a8d39074a4d44c63eda73401580c5c76acda2ce969e0a38e83"},
{file = "numpy-2.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc7b73d02efb0e18c000e9ad8b83480dfcd5dfd11065997ed4c6747470ae8915"},
{file = "numpy-2.2.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:74d4531beb257d2c3f4b261bfb0fc09e0f9ebb8842d82a7b4209415896adc680"},
{file = "numpy-2.2.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8fc377d995680230e83241d8a96def29f204b5782f371c532579b4f20607a289"},
{file = "numpy-2.2.6-cp310-cp310-win32.whl", hash = "sha256:b093dd74e50a8cba3e873868d9e93a85b78e0daf2e98c6797566ad8044e8363d"},
{file = "numpy-2.2.6-cp310-cp310-win_amd64.whl", hash = "sha256:f0fd6321b839904e15c46e0d257fdd101dd7f530fe03fd6359c1ea63738703f3"},
{file = "numpy-2.2.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f9f1adb22318e121c5c69a09142811a201ef17ab257a1e66ca3025065b7f53ae"},
{file = "numpy-2.2.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c820a93b0255bc360f53eca31a0e676fd1101f673dda8da93454a12e23fc5f7a"},
{file = "numpy-2.2.6-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:3d70692235e759f260c3d837193090014aebdf026dfd167834bcba43e30c2a42"},
{file = "numpy-2.2.6-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:481b49095335f8eed42e39e8041327c05b0f6f4780488f61286ed3c01368d491"},
{file = "numpy-2.2.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b64d8d4d17135e00c8e346e0a738deb17e754230d7e0810ac5012750bbd85a5a"},
{file = "numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba10f8411898fc418a521833e014a77d3ca01c15b0c6cdcce6a0d2897e6dbbdf"},
{file = "numpy-2.2.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd48227a919f1bafbdda0583705e547892342c26fb127219d60a5c36882609d1"},
{file = "numpy-2.2.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9551a499bf125c1d4f9e250377c1ee2eddd02e01eac6644c080162c0c51778ab"},
{file = "numpy-2.2.6-cp311-cp311-win32.whl", hash = "sha256:0678000bb9ac1475cd454c6b8c799206af8107e310843532b04d49649c717a47"},
{file = "numpy-2.2.6-cp311-cp311-win_amd64.whl", hash = "sha256:e8213002e427c69c45a52bbd94163084025f533a55a59d6f9c5b820774ef3303"},
{file = "numpy-2.2.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:41c5a21f4a04fa86436124d388f6ed60a9343a6f767fced1a8a71c3fbca038ff"},
{file = "numpy-2.2.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de749064336d37e340f640b05f24e9e3dd678c57318c7289d222a8a2f543e90c"},
{file = "numpy-2.2.6-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:894b3a42502226a1cac872f840030665f33326fc3dac8e57c607905773cdcde3"},
{file = "numpy-2.2.6-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:71594f7c51a18e728451bb50cc60a3ce4e6538822731b2933209a1f3614e9282"},
{file = "numpy-2.2.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2618db89be1b4e05f7a1a847a9c1c0abd63e63a1607d892dd54668dd92faf87"},
{file = "numpy-2.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd83c01228a688733f1ded5201c678f0c53ecc1006ffbc404db9f7a899ac6249"},
{file = "numpy-2.2.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:37c0ca431f82cd5fa716eca9506aefcabc247fb27ba69c5062a6d3ade8cf8f49"},
{file = "numpy-2.2.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fe27749d33bb772c80dcd84ae7e8df2adc920ae8297400dabec45f0dedb3f6de"},
{file = "numpy-2.2.6-cp312-cp312-win32.whl", hash = "sha256:4eeaae00d789f66c7a25ac5f34b71a7035bb474e679f410e5e1a94deb24cf2d4"},
{file = "numpy-2.2.6-cp312-cp312-win_amd64.whl", hash = "sha256:c1f9540be57940698ed329904db803cf7a402f3fc200bfe599334c9bd84a40b2"},
{file = "numpy-2.2.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0811bb762109d9708cca4d0b13c4f67146e3c3b7cf8d34018c722adb2d957c84"},
{file = "numpy-2.2.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:287cc3162b6f01463ccd86be154f284d0893d2b3ed7292439ea97eafa8170e0b"},
{file = "numpy-2.2.6-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:f1372f041402e37e5e633e586f62aa53de2eac8d98cbfb822806ce4bbefcb74d"},
{file = "numpy-2.2.6-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:55a4d33fa519660d69614a9fad433be87e5252f4b03850642f88993f7b2ca566"},
{file = "numpy-2.2.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f92729c95468a2f4f15e9bb94c432a9229d0d50de67304399627a943201baa2f"},
{file = "numpy-2.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1bc23a79bfabc5d056d106f9befb8d50c31ced2fbc70eedb8155aec74a45798f"},
{file = "numpy-2.2.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e3143e4451880bed956e706a3220b4e5cf6172ef05fcc397f6f36a550b1dd868"},
{file = "numpy-2.2.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b4f13750ce79751586ae2eb824ba7e1e8dba64784086c98cdbbcc6a42112ce0d"},
{file = "numpy-2.2.6-cp313-cp313-win32.whl", hash = "sha256:5beb72339d9d4fa36522fc63802f469b13cdbe4fdab4a288f0c441b74272ebfd"},
{file = "numpy-2.2.6-cp313-cp313-win_amd64.whl", hash = "sha256:b0544343a702fa80c95ad5d3d608ea3599dd54d4632df855e4c8d24eb6ecfa1c"},
{file = "numpy-2.2.6-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0bca768cd85ae743b2affdc762d617eddf3bcf8724435498a1e80132d04879e6"},
{file = "numpy-2.2.6-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:fc0c5673685c508a142ca65209b4e79ed6740a4ed6b2267dbba90f34b0b3cfda"},
{file = "numpy-2.2.6-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:5bd4fc3ac8926b3819797a7c0e2631eb889b4118a9898c84f585a54d475b7e40"},
{file = "numpy-2.2.6-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:fee4236c876c4e8369388054d02d0e9bb84821feb1a64dd59e137e6511a551f8"},
{file = "numpy-2.2.6-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e1dda9c7e08dc141e0247a5b8f49cf05984955246a327d4c48bda16821947b2f"},
{file = "numpy-2.2.6-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f447e6acb680fd307f40d3da4852208af94afdfab89cf850986c3ca00562f4fa"},
{file = "numpy-2.2.6-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:389d771b1623ec92636b0786bc4ae56abafad4a4c513d36a55dce14bd9ce8571"},
{file = "numpy-2.2.6-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8e9ace4a37db23421249ed236fdcdd457d671e25146786dfc96835cd951aa7c1"},
{file = "numpy-2.2.6-cp313-cp313t-win32.whl", hash = "sha256:038613e9fb8c72b0a41f025a7e4c3f0b7a1b5d768ece4796b674c8f3fe13efff"},
{file = "numpy-2.2.6-cp313-cp313t-win_amd64.whl", hash = "sha256:6031dd6dfecc0cf9f668681a37648373bddd6421fff6c66ec1624eed0180ee06"},
{file = "numpy-2.2.6-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0b605b275d7bd0c640cad4e5d30fa701a8d59302e127e5f79138ad62762c3e3d"},
{file = "numpy-2.2.6-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:7befc596a7dc9da8a337f79802ee8adb30a552a94f792b9c9d18c840055907db"},
{file = "numpy-2.2.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce47521a4754c8f4593837384bd3424880629f718d87c5d44f8ed763edd63543"},
{file = "numpy-2.2.6-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d042d24c90c41b54fd506da306759e06e568864df8ec17ccc17e9e884634fd00"},
{file = "numpy-2.2.6.tar.gz", hash = "sha256:e29554e2bef54a90aa5cc07da6ce955accb83f21ab5de01a62c8478897b264fd"},
]
[[package]]
@@ -3485,44 +3587,46 @@ httpx = ">=0.27"
pydantic = ">=2.9"
[[package]]
name = "onnx"
version = "1.18.0"
name = "onnx-weekly"
version = "1.19.0.dev20250602"
description = "Open Neural Network Exchange"
optional = false
python-versions = ">=3.9"
groups = ["main"]
files = [
{file = "onnx-1.18.0-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:4a3b50d94620e2c7c1404d1d59bc53e665883ae3fecbd856cc86da0639fd0fc3"},
{file = "onnx-1.18.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e189652dad6e70a0465035c55cc565c27aa38803dd4f4e74e4b952ee1c2de94b"},
{file = "onnx-1.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfb1f271b1523b29f324bfd223f6a4cfbdc5a2f2f16e73563671932d33663365"},
{file = "onnx-1.18.0-cp310-cp310-win32.whl", hash = "sha256:e03071041efd82e0317b3c45433b2f28146385b80f26f82039bc68048ac1a7a0"},
{file = "onnx-1.18.0-cp310-cp310-win_amd64.whl", hash = "sha256:9235b3493951e11e75465d56f4cd97e3e9247f096160dd3466bfabe4cbc938bc"},
{file = "onnx-1.18.0-cp311-cp311-macosx_12_0_universal2.whl", hash = "sha256:735e06d8d0cf250dc498f54038831401063c655a8d6e5975b2527a4e7d24be3e"},
{file = "onnx-1.18.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:73160799472e1a86083f786fecdf864cf43d55325492a9b5a1cfa64d8a523ecc"},
{file = "onnx-1.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6acafb3823238bbe8f4340c7ac32fb218689442e074d797bee1c5c9a02fdae75"},
{file = "onnx-1.18.0-cp311-cp311-win32.whl", hash = "sha256:4c8c4bbda760c654e65eaffddb1a7de71ec02e60092d33f9000521f897c99be9"},
{file = "onnx-1.18.0-cp311-cp311-win_amd64.whl", hash = "sha256:a5810194f0f6be2e58c8d6dedc6119510df7a14280dd07ed5f0f0a85bd74816a"},
{file = "onnx-1.18.0-cp311-cp311-win_arm64.whl", hash = "sha256:aa1b7483fac6cdec26922174fc4433f8f5c2f239b1133c5625063bb3b35957d0"},
{file = "onnx-1.18.0-cp312-cp312-macosx_12_0_universal2.whl", hash = "sha256:521bac578448667cbb37c50bf05b53c301243ede8233029555239930996a625b"},
{file = "onnx-1.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e4da451bf1c5ae381f32d430004a89f0405bc57a8471b0bddb6325a5b334aa40"},
{file = "onnx-1.18.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99afac90b4cdb1471432203c3c1f74e16549c526df27056d39f41a9a47cfb4af"},
{file = "onnx-1.18.0-cp312-cp312-win32.whl", hash = "sha256:ee159b41a3ae58d9c7341cf432fc74b96aaf50bd7bb1160029f657b40dc69715"},
{file = "onnx-1.18.0-cp312-cp312-win_amd64.whl", hash = "sha256:102c04edc76b16e9dfeda5a64c1fccd7d3d2913b1544750c01d38f1ac3c04e05"},
{file = "onnx-1.18.0-cp312-cp312-win_arm64.whl", hash = "sha256:911b37d724a5d97396f3c2ef9ea25361c55cbc9aa18d75b12a52b620b67145af"},
{file = "onnx-1.18.0-cp313-cp313-macosx_12_0_universal2.whl", hash = "sha256:030d9f5f878c5f4c0ff70a4545b90d7812cd6bfe511de2f3e469d3669c8cff95"},
{file = "onnx-1.18.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8521544987d713941ee1e591520044d35e702f73dc87e91e6d4b15a064ae813d"},
{file = "onnx-1.18.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c137eecf6bc618c2f9398bcc381474b55c817237992b169dfe728e169549e8f"},
{file = "onnx-1.18.0-cp313-cp313-win32.whl", hash = "sha256:6c093ffc593e07f7e33862824eab9225f86aa189c048dd43ffde207d7041a55f"},
{file = "onnx-1.18.0-cp313-cp313-win_amd64.whl", hash = "sha256:230b0fb615e5b798dc4a3718999ec1828360bc71274abd14f915135eab0255f1"},
{file = "onnx-1.18.0-cp313-cp313-win_arm64.whl", hash = "sha256:6f91930c1a284135db0f891695a263fc876466bf2afbd2215834ac08f600cfca"},
{file = "onnx-1.18.0-cp313-cp313t-macosx_12_0_universal2.whl", hash = "sha256:2f4d37b0b5c96a873887652d1cbf3f3c70821b8c66302d84b0f0d89dd6e47653"},
{file = "onnx-1.18.0-cp313-cp313t-win_amd64.whl", hash = "sha256:a69afd0baa372162948b52c13f3aa2730123381edf926d7ef3f68ca7cec6d0d0"},
{file = "onnx-1.18.0-cp39-cp39-macosx_12_0_universal2.whl", hash = "sha256:a186b1518450e04dc3679da315a663a56429418e7ccfd947d721de9bd710b0ea"},
{file = "onnx-1.18.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dc22abacfb0d3cd024d6ab784cb5eb5aca9c966a791e8e13b1a4ecb93ddb47d3"},
{file = "onnx-1.18.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7839bf2adb494e46ccf375a7936b5d9e241b63e1a84254f3eb2e2e184e3292c8"},
{file = "onnx-1.18.0-cp39-cp39-win32.whl", hash = "sha256:2bd5c0c55669b6d8f12e859cc27f3a631fe58730871b21f001527e1d56219e2a"},
{file = "onnx-1.18.0-cp39-cp39-win_amd64.whl", hash = "sha256:a3ff1735f99589be4f311eb586f2b949998614a82fb6261ae6af5a29879b9375"},
{file = "onnx-1.18.0.tar.gz", hash = "sha256:3d8dbf9e996629131ba3aa1afd1d8239b660d1f830c6688dd7e03157cccd6b9c"},
{file = "onnx_weekly-1.19.0.dev20250602-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:915f03fdc94ebdb295dcf9537d4a2b5bcbc5573f906441f44ad259f20f32392b"},
{file = "onnx_weekly-1.19.0.dev20250602-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:32a94177f16ee1d3cb63e8a7aa35e6932259bf0d7a79848013e865b3a93ff90e"},
{file = "onnx_weekly-1.19.0.dev20250602-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4e19aabacdcaf838d697de6e2b9c7f84d396537f2d8974ed3934d092062b905b"},
{file = "onnx_weekly-1.19.0.dev20250602-cp310-cp310-win32.whl", hash = "sha256:42c45c6099d1e0b7561318bb997e7af96c99914bfa2ad62a1c352ef8ca16c1ad"},
{file = "onnx_weekly-1.19.0.dev20250602-cp310-cp310-win_amd64.whl", hash = "sha256:4fe15de337bfb1a6627b53f4d668b7c180cada6ec84498cad80f7468cbbb9fdb"},
{file = "onnx_weekly-1.19.0.dev20250602-cp311-cp311-macosx_12_0_universal2.whl", hash = "sha256:65bf398829c5ed7095d2c570144c0b169ae7a59d3fabc3a15c767ccb8805015d"},
{file = "onnx_weekly-1.19.0.dev20250602-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c800b6ab1e804fdcd8ce4d06526761a19cd31a67c06a2e0a797611484f5cad6c"},
{file = "onnx_weekly-1.19.0.dev20250602-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b14273669fe509f8138d45cc6e991b4132a5a06ee7e7e9617246d1b47378f104"},
{file = "onnx_weekly-1.19.0.dev20250602-cp311-cp311-win32.whl", hash = "sha256:d54a8456d7aaea937664c600f2960749f92c4248e545f50d03b4249e00b008d1"},
{file = "onnx_weekly-1.19.0.dev20250602-cp311-cp311-win_amd64.whl", hash = "sha256:76e30dfeb4aa6f5c58c7c778f5203cf3e7ab55d2e27d0dddf3de1f6cefc4a37b"},
{file = "onnx_weekly-1.19.0.dev20250602-cp311-cp311-win_arm64.whl", hash = "sha256:afb64c06ff470138698608b32e083390ca12a0b0743bea6e2dab840d4c555bcd"},
{file = "onnx_weekly-1.19.0.dev20250602-cp312-cp312-macosx_12_0_universal2.whl", hash = "sha256:512c7c233f73573a3756bae0f41da81cb3342a1751ad9d9763d4f3913bb04140"},
{file = "onnx_weekly-1.19.0.dev20250602-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:36c9011714633917e33a9059ec1af3d6261489b12b9304dd8605510243b7e05a"},
{file = "onnx_weekly-1.19.0.dev20250602-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d0540e02654a46f884792dd8ce781632b4f2bec13ff6d4d6382b6602696a8c82"},
{file = "onnx_weekly-1.19.0.dev20250602-cp312-cp312-win32.whl", hash = "sha256:5d7d7ded2d72f4d7c732da489472307ff3fcd046a872968badb2cd8bd6e44598"},
{file = "onnx_weekly-1.19.0.dev20250602-cp312-cp312-win_amd64.whl", hash = "sha256:b727c3c5578872ea6603406cdcd6eb47566fd5e4af7075c28a3c70316591a166"},
{file = "onnx_weekly-1.19.0.dev20250602-cp312-cp312-win_arm64.whl", hash = "sha256:3b81e0f6d35cd7ac96fb695d1152e98f38fcc00c9ab3ea466342456dfd83a7e4"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313-macosx_12_0_universal2.whl", hash = "sha256:592c9e66eb7b0636563316eba30329d02f6449602fd509a354d247c39955ffd1"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c16c2b2c00bbaf0964e2a6dd377e06ff025cfb5d26b73c43cd85e7cc3c1cdb54"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:09394f1b065bbab147c4f9b9ea9b9e980d002ba56dd7b33812ee9dc651c1fa22"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313-win32.whl", hash = "sha256:4afc9b075e47c4da63e5a3148b273b15ddf02110ec1fb13413d3af04d2593c32"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313-win_amd64.whl", hash = "sha256:760dfd7059475d48aedc51bdfed20a63839fb3ae9d58d7402230267c99931f4a"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313-win_arm64.whl", hash = "sha256:917db217bfe5cb64c52d69f85d78ca649acc7b81bb771cc00bb4a0aec802353b"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313t-macosx_12_0_universal2.whl", hash = "sha256:25f43916ce4ed39f32da3fa870f3a542ff9c8b7753fd05c08cf266886f1b5a45"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bfa0a0194e7ccda0b6acbf48fb5d10c7f6d792881bf8f4eae6aa5abb14c410e8"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7898a509495b3f1c7ee77f2c06bd49d28302610a3137d9dee035155c5a227fc7"},
{file = "onnx_weekly-1.19.0.dev20250602-cp313-cp313t-win_amd64.whl", hash = "sha256:1f650885dbad8b3e16602e1d05322167be5216fe6e1b45d34ece80a31a88d854"},
{file = "onnx_weekly-1.19.0.dev20250602-cp39-cp39-macosx_12_0_universal2.whl", hash = "sha256:b340c9226a203ed572315cc11d17e8d631709fc9d13bd9d0ad1677f14d4574a3"},
{file = "onnx_weekly-1.19.0.dev20250602-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d84d7081702268adb148b30b9dde26bd2769c57b79cf70838d2463df53825008"},
{file = "onnx_weekly-1.19.0.dev20250602-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6dfa8bd7396f3020df6866aab1d39a36183e6d361d6a4bf0b02e3b50ee64493e"},
{file = "onnx_weekly-1.19.0.dev20250602-cp39-cp39-win32.whl", hash = "sha256:bb3c903a8b270cb633f4a2dccc18ffa1c11e10f60e56235ec05867c22b48f071"},
{file = "onnx_weekly-1.19.0.dev20250602-cp39-cp39-win_amd64.whl", hash = "sha256:2c07dec2e94cdea9d67028da9b36824511ad34547bc91801d7f7fdd0ee3879b2"},
{file = "onnx_weekly-1.19.0.dev20250602.tar.gz", hash = "sha256:d2c7253847c8f930ffc07e267a576de10571d55c41af31a5ca1d8a8682abe9b4"},
]
[package.dependencies]
@@ -3534,20 +3638,20 @@ typing_extensions = ">=4.7.1"
reference = ["Pillow", "google-re2 ; python_version < \"3.13\""]
[[package]]
name = "onnx2torch"
version = "1.5.15"
name = "onnx2torch-py313"
version = "1.6.0"
description = "ONNX to PyTorch converter"
optional = false
python-versions = ">=3.6"
groups = ["main"]
files = [
{file = "onnx2torch-1.5.15-py3-none-any.whl", hash = "sha256:123258e0f147e07b259cf845c8113c5634b8260e52c5fb26b7d507226732d9e5"},
{file = "onnx2torch-1.5.15.tar.gz", hash = "sha256:d2a239cf0871cbbeec13d43e2a72ac2f8b3c8dcf80695e4d1040c3deed2b14a2"},
{file = "onnx2torch_py313-1.6.0-py3-none-any.whl", hash = "sha256:03b1cc771f93941cc221635547e97dd7823dffc05f052057e51c6a45fbacba70"},
{file = "onnx2torch_py313-1.6.0.tar.gz", hash = "sha256:d27b54c7e170f12ad252fe186e6cab8f3cade8ee4e596682acc5a3afddadb753"},
]
[package.dependencies]
numpy = ">=1.16.4"
onnx = ">=1.9.0"
onnx-weekly = "*"
torch = ">=1.8.0"
torchvision = ">=0.9.0"
@@ -5116,6 +5220,7 @@ description = "Fundamental algorithms for scientific computing in Python"
optional = false
python-versions = ">=3.10"
groups = ["main"]
markers = "python_version < \"3.13\""
files = [
{file = "scipy-1.15.3-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:a345928c86d535060c9c2b25e71e87c39ab2f22fc96e9636bd74d1dbf9de448c"},
{file = "scipy-1.15.3-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:ad3432cb0f9ed87477a8d97f03b763fd1d57709f1bbde3c9369b1dff5503b253"},
@@ -5173,6 +5278,62 @@ dev = ["cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy (==1.10.0)", "pycodest
doc = ["intersphinx_registry", "jupyterlite-pyodide-kernel", "jupyterlite-sphinx (>=0.19.1)", "jupytext", "matplotlib (>=3.5)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (>=0.15.2)", "sphinx (>=5.0.0,<8.0.0)", "sphinx-copybutton", "sphinx-design (>=0.4.0)"]
test = ["Cython", "array-api-strict (>=2.0,<2.1.1)", "asv", "gmpy2", "hypothesis (>=6.30)", "meson", "mpmath", "ninja ; sys_platform != \"emscripten\"", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"]
[[package]]
name = "scipy"
version = "1.16.0"
description = "Fundamental algorithms for scientific computing in Python"
optional = false
python-versions = ">=3.11"
groups = ["main"]
markers = "python_version == \"3.13\""
files = [
{file = "scipy-1.16.0-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:deec06d831b8f6b5fb0b652433be6a09db29e996368ce5911faf673e78d20085"},
{file = "scipy-1.16.0-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:d30c0fe579bb901c61ab4bb7f3eeb7281f0d4c4a7b52dbf563c89da4fd2949be"},
{file = "scipy-1.16.0-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:b2243561b45257f7391d0f49972fca90d46b79b8dbcb9b2cb0f9df928d370ad4"},
{file = "scipy-1.16.0-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:e6d7dfc148135e9712d87c5f7e4f2ddc1304d1582cb3a7d698bbadedb61c7afd"},
{file = "scipy-1.16.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:90452f6a9f3fe5a2cf3748e7be14f9cc7d9b124dce19667b54f5b429d680d539"},
{file = "scipy-1.16.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a2f0bf2f58031c8701a8b601df41701d2a7be17c7ffac0a4816aeba89c4cdac8"},
{file = "scipy-1.16.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6c4abb4c11fc0b857474241b812ce69ffa6464b4bd8f4ecb786cf240367a36a7"},
{file = "scipy-1.16.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b370f8f6ac6ef99815b0d5c9f02e7ade77b33007d74802efc8316c8db98fd11e"},
{file = "scipy-1.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:a16ba90847249bedce8aa404a83fb8334b825ec4a8e742ce6012a7a5e639f95c"},
{file = "scipy-1.16.0-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:7eb6bd33cef4afb9fa5f1fb25df8feeb1e52d94f21a44f1d17805b41b1da3180"},
{file = "scipy-1.16.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:1dbc8fdba23e4d80394ddfab7a56808e3e6489176d559c6c71935b11a2d59db1"},
{file = "scipy-1.16.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:7dcf42c380e1e3737b343dec21095c9a9ad3f9cbe06f9c05830b44b1786c9e90"},
{file = "scipy-1.16.0-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:26ec28675f4a9d41587266084c626b02899db373717d9312fa96ab17ca1ae94d"},
{file = "scipy-1.16.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:952358b7e58bd3197cfbd2f2f2ba829f258404bdf5db59514b515a8fe7a36c52"},
{file = "scipy-1.16.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:03931b4e870c6fef5b5c0970d52c9f6ddd8c8d3e934a98f09308377eba6f3824"},
{file = "scipy-1.16.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:512c4f4f85912767c351a0306824ccca6fd91307a9f4318efe8fdbd9d30562ef"},
{file = "scipy-1.16.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e69f798847e9add03d512eaf5081a9a5c9a98757d12e52e6186ed9681247a1ac"},
{file = "scipy-1.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:adf9b1999323ba335adc5d1dc7add4781cb5a4b0ef1e98b79768c05c796c4e49"},
{file = "scipy-1.16.0-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:e9f414cbe9ca289a73e0cc92e33a6a791469b6619c240aa32ee18abdce8ab451"},
{file = "scipy-1.16.0-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:bbba55fb97ba3cdef9b1ee973f06b09d518c0c7c66a009c729c7d1592be1935e"},
{file = "scipy-1.16.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:58e0d4354eacb6004e7aa1cd350e5514bd0270acaa8d5b36c0627bb3bb486974"},
{file = "scipy-1.16.0-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:75b2094ec975c80efc273567436e16bb794660509c12c6a31eb5c195cbf4b6dc"},
{file = "scipy-1.16.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6b65d232157a380fdd11a560e7e21cde34fdb69d65c09cb87f6cc024ee376351"},
{file = "scipy-1.16.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1d8747f7736accd39289943f7fe53a8333be7f15a82eea08e4afe47d79568c32"},
{file = "scipy-1.16.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:eb9f147a1b8529bb7fec2a85cf4cf42bdfadf9e83535c309a11fdae598c88e8b"},
{file = "scipy-1.16.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d2b83c37edbfa837a8923d19c749c1935ad3d41cf196006a24ed44dba2ec4358"},
{file = "scipy-1.16.0-cp313-cp313-win_amd64.whl", hash = "sha256:79a3c13d43c95aa80b87328a46031cf52508cf5f4df2767602c984ed1d3c6bbe"},
{file = "scipy-1.16.0-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:f91b87e1689f0370690e8470916fe1b2308e5b2061317ff76977c8f836452a47"},
{file = "scipy-1.16.0-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:88a6ca658fb94640079e7a50b2ad3b67e33ef0f40e70bdb7dc22017dae73ac08"},
{file = "scipy-1.16.0-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:ae902626972f1bd7e4e86f58fd72322d7f4ec7b0cfc17b15d4b7006efc385176"},
{file = "scipy-1.16.0-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:8cb824c1fc75ef29893bc32b3ddd7b11cf9ab13c1127fe26413a05953b8c32ed"},
{file = "scipy-1.16.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:de2db7250ff6514366a9709c2cba35cb6d08498e961cba20d7cff98a7ee88938"},
{file = "scipy-1.16.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e85800274edf4db8dd2e4e93034f92d1b05c9421220e7ded9988b16976f849c1"},
{file = "scipy-1.16.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4f720300a3024c237ace1cb11f9a84c38beb19616ba7c4cdcd771047a10a1706"},
{file = "scipy-1.16.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:aad603e9339ddb676409b104c48a027e9916ce0d2838830691f39552b38a352e"},
{file = "scipy-1.16.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f56296fefca67ba605fd74d12f7bd23636267731a72cb3947963e76b8c0a25db"},
{file = "scipy-1.16.0.tar.gz", hash = "sha256:b5ef54021e832869c8cfb03bc3bf20366cbcd426e02a58e8a58d7584dfbb8f62"},
]
[package.dependencies]
numpy = ">=1.25.2,<2.6"
[package.extras]
dev = ["cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy (==1.10.0)", "pycodestyle", "pydevtool", "rich-click", "ruff (>=0.0.292)", "types-psutil", "typing_extensions"]
doc = ["intersphinx_registry", "jupyterlite-pyodide-kernel", "jupyterlite-sphinx (>=0.19.1)", "jupytext", "linkify-it-py", "matplotlib (>=3.5)", "myst-nb (>=1.2.0)", "numpydoc", "pooch", "pydata-sphinx-theme (>=0.15.2)", "sphinx (>=5.0.0,<8.2.0)", "sphinx-copybutton", "sphinx-design (>=0.4.0)"]
test = ["Cython", "array-api-strict (>=2.3.1)", "asv", "gmpy2", "hypothesis (>=6.30)", "meson", "mpmath", "ninja ; sys_platform != \"emscripten\"", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"]
[[package]]
name = "secretstorage"
version = "3.3.3"
@@ -5507,6 +5668,8 @@ files = [
]
[package.dependencies]
audioop-lts = {version = "*", markers = "python_version >= \"3.13\""}
standard-aifc = {version = "*", markers = "python_version >= \"3.13\""}
typing-extensions = "*"
[package.extras]
@@ -5590,6 +5753,52 @@ files = [
[package.dependencies]
catalogue = ">=2.0.3,<2.1.0"
[[package]]
name = "standard-aifc"
version = "3.13.0"
description = "Standard library aifc redistribution. \"dead battery\"."
optional = false
python-versions = "*"
groups = ["main"]
markers = "python_version == \"3.13\""
files = [
{file = "standard_aifc-3.13.0-py3-none-any.whl", hash = "sha256:f7ae09cc57de1224a0dd8e3eb8f73830be7c3d0bc485de4c1f82b4a7f645ac66"},
{file = "standard_aifc-3.13.0.tar.gz", hash = "sha256:64e249c7cb4b3daf2fdba4e95721f811bde8bdfc43ad9f936589b7bb2fae2e43"},
]
[package.dependencies]
audioop-lts = {version = "*", markers = "python_version >= \"3.13\""}
standard-chunk = {version = "*", markers = "python_version >= \"3.13\""}
[[package]]
name = "standard-chunk"
version = "3.13.0"
description = "Standard library chunk redistribution. \"dead battery\"."
optional = false
python-versions = "*"
groups = ["main"]
markers = "python_version == \"3.13\""
files = [
{file = "standard_chunk-3.13.0-py3-none-any.whl", hash = "sha256:17880a26c285189c644bd5bd8f8ed2bdb795d216e3293e6dbe55bbd848e2982c"},
{file = "standard_chunk-3.13.0.tar.gz", hash = "sha256:4ac345d37d7e686d2755e01836b8d98eda0d1a3ee90375e597ae43aaf064d654"},
]
[[package]]
name = "standard-sunau"
version = "3.13.0"
description = "Standard library sunau redistribution. \"dead battery\"."
optional = false
python-versions = "*"
groups = ["main"]
markers = "python_version == \"3.13\""
files = [
{file = "standard_sunau-3.13.0-py3-none-any.whl", hash = "sha256:53af624a9529c41062f4c2fd33837f297f3baa196b0cfceffea6555654602622"},
{file = "standard_sunau-3.13.0.tar.gz", hash = "sha256:b319a1ac95a09a2378a8442f403c66f4fd4b36616d6df6ae82b8e536ee790908"},
]
[package.dependencies]
audioop-lts = {version = "*", markers = "python_version >= \"3.13\""}
[[package]]
name = "starlette"
version = "0.46.2"
@@ -5748,45 +5957,60 @@ rapidfuzz = ">=3.0.0,<4.0.0"
[[package]]
name = "thinc"
version = "8.3.4"
version = "8.3.6"
description = "A refreshing functional take on deep learning, compatible with your favorite libraries"
optional = false
python-versions = "<3.13,>=3.9"
python-versions = "<3.14,>=3.9"
groups = ["main"]
files = [
{file = "thinc-8.3.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:916ea79a7c7462664be9435679b7769b4fc1ecea3886db6da6118e4eb5cc8c8b"},
{file = "thinc-8.3.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6c985ce9cf82a611f4f348c721372d073537ca0e8b7bbb8bd865c1598ddd79d1"},
{file = "thinc-8.3.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fff4b30f8513832d13a31486e9074a7020de3d48f8a3d1527e369c242d6ebe9"},
{file = "thinc-8.3.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:a9ee46d19b9f4cac13a5539f97978c857338a31e4bf8d9b3a7741dcbc792220f"},
{file = "thinc-8.3.4-cp310-cp310-win_amd64.whl", hash = "sha256:d08529d53f8652e15e4f3c0f6953e73f85cc71d3b6e4750d2d9ace23616dbe8f"},
{file = "thinc-8.3.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a8bb4b47358a1855803b375f4432cefdf373f46ef249b554418d2e77c7323040"},
{file = "thinc-8.3.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:00ed92f9a34b9794f51fcd48467c863f4eb7c5b41559aef6ef3c980c21378fec"},
{file = "thinc-8.3.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:85691fca84a6a1506f7ddbd2c1706a5524d56f65582e76b2e260a06d9e83e86d"},
{file = "thinc-8.3.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:eae1573fc19e514defc1bfd4f93f0b4bfc1dcefdb6d70bad1863825747f24800"},
{file = "thinc-8.3.4-cp311-cp311-win_amd64.whl", hash = "sha256:81e8638f9bdc38e366674acc4b63cf7c6267266a15477963a5db21b3d9f1aa36"},
{file = "thinc-8.3.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c9da6375b106df5186bd2bfd1273bc923c01ab7d482f8942e4ee528a28965c3a"},
{file = "thinc-8.3.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:07091c6b5faace50857c4cf0982204969d77388d0a6f156dd2442297dceeb838"},
{file = "thinc-8.3.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd40ad71bcd8b1b9daa0462e1255b1c1e86e901c2fd773966601f44a95878032"},
{file = "thinc-8.3.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:eb10823b3a3f1c6440998b11bf9a3571dd859feaed0fdb510a1c1097d9dc6a86"},
{file = "thinc-8.3.4-cp312-cp312-win_amd64.whl", hash = "sha256:b5e5e7bf5dae142fd50ed9785971292c4aab4d9ed18e4947653b6a0584d5227c"},
{file = "thinc-8.3.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:960366f41f0d5c4cecdf8610d03bdf80b14a959a7fe94008b788a5336d388781"},
{file = "thinc-8.3.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d85babfae9b31e2e20f4884787b1391ca126f84e9b9f7f498990c07f7019f848"},
{file = "thinc-8.3.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8791c87857c474499455bfdd3f58432e2dc1e2cdadf46eb2f3c2293851a8a837"},
{file = "thinc-8.3.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:c95456cbc1344ab9041c2e16c9fa065ac2b56520929a5a594b3c80ddda136b1e"},
{file = "thinc-8.3.4-cp39-cp39-win_amd64.whl", hash = "sha256:11e6e14c1bfdb7c456f3da19dcf94def8304a7b279329f328e55062a292bc79f"},
{file = "thinc-8.3.4.tar.gz", hash = "sha256:b5925482498bbb6dca0771e375b35c915818f735891e93d93a662dab15f6ffd8"},
{file = "thinc-8.3.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f4abec5a35e5945a6573b62bf0f423709467ba321fea9d00770b4c5282a8257d"},
{file = "thinc-8.3.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ba7ced4bfc5890dd8f4be2978f8d491a07e80c9d9a7fffae9f57970b55db01bd"},
{file = "thinc-8.3.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e645517d87f71e92137a1aef028094d134223885e15b8472bfcdc09665973ed"},
{file = "thinc-8.3.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10d8451dd08386d6bbde8160fd0e5e057e04a330c168837d3e0f278fa8738eea"},
{file = "thinc-8.3.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:0e913f120fde25aea9f052e8cd45dd9cd36553ff1903e312b7302dd91000125a"},
{file = "thinc-8.3.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:03706680bc0ea92036ac2e00f46bc86116ac6dccb6212b0c632e835176f666b2"},
{file = "thinc-8.3.6-cp310-cp310-win_amd64.whl", hash = "sha256:0902314ecb83a225f41ab6121ceaf139b5da8bb6ada9e58031bad6c46134b8d4"},
{file = "thinc-8.3.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7c7c44f8736f27d1cced216246c00e219fb5734e6bc3b8a78c09157c011aae59"},
{file = "thinc-8.3.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:92b3c38bdfdf81d0485685a6261b8a6ea40e03120b08ced418c8400f5e186b2d"},
{file = "thinc-8.3.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:853eb187b1f77057adada1a72e7f6ea3f38643930363681cfd5de285dab4b09b"},
{file = "thinc-8.3.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c12bf75a375b3b1f7c32a26cbd69255b177daa693c986a27faaf2027439c7ef"},
{file = "thinc-8.3.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5bf1708c22fb54e7846e8e743a9e6a43a22cbe24cab0081ba4e6362b4437a53f"},
{file = "thinc-8.3.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:169d7c5779f6f1a78fa91b2bc3a6485f7bbe4341bd8064576f8e067b67b6a0b5"},
{file = "thinc-8.3.6-cp311-cp311-win_amd64.whl", hash = "sha256:59c244ce11a3359b9a33b4c3bbc9ba94f7174214356ed88c16a41e39f31fe372"},
{file = "thinc-8.3.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c54705e45a710e49758192592a3e0a80482edfdf5c61fc99f5d27ae822f652c5"},
{file = "thinc-8.3.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:91acdbf3041c0ac1775ede570535a779cdf1312c317cd054d7b9d200da685c23"},
{file = "thinc-8.3.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f5a1db861614f91ff127feecce681c2213777b2d3d1ee6644bcc8a886acf0595"},
{file = "thinc-8.3.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:512e461989df8a30558367061d63ae6f1a6b4abe3c016a3360ee827e824254e0"},
{file = "thinc-8.3.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a087aea2a63e6b9ccde61163d5922553b58908e96f8ad49cd0fd2edeb43e063f"},
{file = "thinc-8.3.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b1d85dd5d94bb75006864c7d99fd5b75d05b1602d571e7fcdb42d4521f962048"},
{file = "thinc-8.3.6-cp312-cp312-win_amd64.whl", hash = "sha256:1170d85294366127d97a27dd5896f4abe90e2a5ea2b7988de9a5bb8e1128d222"},
{file = "thinc-8.3.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:d8743ee8ad2d59fda018b57e5da102d6098bbeb0f70476f3fd8ceb9d215d88b9"},
{file = "thinc-8.3.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:89dbeb2ca94f1033e90999a70e2bc9dd5390d5341dc1a3a4b8793d03855265c3"},
{file = "thinc-8.3.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89a5460695067aa6e4182515cfd2018263db77cc17b7031d50ed696e990797a8"},
{file = "thinc-8.3.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0aa8e32f49234569fd10c35b562ee2f9c0d51225365a6e604a5a67396a49f2c1"},
{file = "thinc-8.3.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f432158b80cf75a096980470b790b51d81daf9c2822598adebfc3cb58588fd6c"},
{file = "thinc-8.3.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:61fb33a22aba40366fa9018ab34580f74fc40be821ab8af77ac1fdbeac17243b"},
{file = "thinc-8.3.6-cp313-cp313-win_amd64.whl", hash = "sha256:ddd7041946a427f6a9b0b49419353d02ad7eb43fe16724bfcc3bdeb9562040b1"},
{file = "thinc-8.3.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4dc929e9882b67b40e376f591c36a0e5596d1616daa6d67dc401ea7270208598"},
{file = "thinc-8.3.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9745f4e57560fbba4cfd6d87ef9a0b09efbb14d7721bd7fdd44411ee4bbd021f"},
{file = "thinc-8.3.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:502011141d42536a48522ee9eae52a2f5e3b2315eeaafb8cf238187acf4f8206"},
{file = "thinc-8.3.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5c83b76ec5faf2e9a52d6c6b307d893bae328bf3d5e623205d225b041ce7fc94"},
{file = "thinc-8.3.6-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:d9fc7436223e83ab02e453bde0f5a878c8cab17679947d99b8a32a5c5bfabb50"},
{file = "thinc-8.3.6-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:5d7518a5d9679c16b0d2df9b99f0280f21618bae3a2551458b08129156828b72"},
{file = "thinc-8.3.6-cp39-cp39-win_amd64.whl", hash = "sha256:658b58b18ea7e2bf540dcbdfe0a129f8d97e1cf5c7c89df685ca213fcce35ff4"},
{file = "thinc-8.3.6.tar.gz", hash = "sha256:49983f9b7ddc4343a9532694a9118dd216d7a600520a21849a43b6c268ec6cad"},
]
[package.dependencies]
blis = ">=1.2.0,<1.3.0"
blis = ">=1.3.0,<1.4.0"
catalogue = ">=2.0.4,<2.1.0"
confection = ">=0.0.1,<1.0.0"
cymem = ">=2.0.2,<2.1.0"
murmurhash = ">=1.0.2,<1.1.0"
numpy = {version = ">=1.19.0,<3.0.0", markers = "python_version >= \"3.9\""}
numpy = ">=2.0.0,<3.0.0"
packaging = ">=20.0"
preshed = ">=3.0.2,<3.1.0"
pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<3.0.0"
pydantic = ">=2.0.0,<3.0.0"
setuptools = "*"
srsly = ">=2.4.0,<3.0.0"
wasabi = ">=0.8.1,<1.2.0"
@@ -6210,6 +6434,7 @@ files = [
{file = "typing_extensions-4.14.0-py3-none-any.whl", hash = "sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af"},
{file = "typing_extensions-4.14.0.tar.gz", hash = "sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4"},
]
markers = {dev = "python_version < \"3.13\""}
[[package]]
name = "typing-inspection"
@@ -6736,5 +6961,5 @@ cffi = ["cffi (>=1.11)"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<3.13"
content-hash = "80c31b29f95bd85fcebb1876ec18cec3399387501e873205ed3468ec6f43cb8d"
python-versions = ">=3.10,<3.14"
content-hash = "ccbe4a7699d20445b28e9e0c9391601157842347b4f3ca1c111cade30117773d"
+12 -11
View File
@@ -5,13 +5,13 @@ description = "Generate karaoke videos with synchronized lyrics. Handles the ent
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
license = "MIT"
readme = "README.md"
packages = [{ include = "karaoke_prep" }]
homepage = "https://github.com/karaokenerds/karaoke-gen"
repository = "https://github.com/karaokenerds/karaoke-gen"
documentation = "https://github.com/karaokenerds/karaoke-gen/blob/main/README.md"
packages = [{ include = "karaoke_gen" }]
homepage = "https://github.com/nomadkaraoke/karaoke-gen"
repository = "https://github.com/nomadkaraoke/karaoke-gen"
documentation = "https://github.com/nomadkaraoke/karaoke-gen/blob/main/README.md"
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
python = ">=3.10,<3.14"
torch = ">=2.7"
requests = ">=2"
beautifulsoup4 = ">=4"
@@ -25,8 +25,8 @@ google-auth = "*"
google-auth-oauthlib = "*"
google-auth-httplib2 = "*"
thefuzz = ">=0.22"
numpy = "^1"
audio-separator = { version = ">=0.21.0", extras = ["cpu"] }
numpy = ">=2"
audio-separator = { version = ">=0.34.0", extras = ["cpu"] }
lyrics-converter = ">=0.2.1"
lyrics-transcriber = ">=0.52"
kbputils = "^0.0.16"
@@ -49,8 +49,8 @@ pytest-asyncio = ">=0.21.0"
[tool.poetry.scripts]
karaoke-gen = 'karaoke_prep.utils.gen_cli:main'
karaoke-bulk = 'karaoke_prep.utils.bulk_cli:main'
karaoke-gen = 'karaoke_gen.utils.gen_cli:main'
karaoke-bulk = 'karaoke_gen.utils.bulk_cli:main'
[tool.black]
line-length = 140
@@ -60,16 +60,17 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
testpaths = ["tests"]
testpaths = ["tests/unit", "tests/integration"]
python_files = ["test_*.py"]
addopts = [
"--cov=karaoke_prep",
"--cov=karaoke_gen",
"--cov-report=term-missing",
"--cov-report=html:htmlcov",
"--asyncio-mode=auto",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"asyncio: mark test as async",
]
filterwarnings = [
@@ -2,11 +2,11 @@ import os
import pytest
import sys
import json
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_prep.file_handler import FileHandler
from karaoke_gen.karaoke_gen import KaraokePrep
from karaoke_gen.file_handler import FileHandler
from unittest.mock import MagicMock, call, patch, AsyncMock, ANY
from karaoke_prep.utils.gen_cli import async_main
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.utils.gen_cli import async_main
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
# Register the asyncio marker
pytest.mark.asyncio = pytest.mark.asyncio
@@ -16,6 +16,7 @@ pytest_configure = lambda config: config.addinivalue_line("markers", "asyncio: m
@pytest.mark.asyncio
@pytest.mark.integration
async def test_cli_edit_lyrics_integration(mocker): # Remove tmp_path
"""Tests the --edit-lyrics CLI workflow using high-level mocks."""
# --- 1. Define Test Variables ---
@@ -30,7 +31,7 @@ async def test_cli_edit_lyrics_integration(mocker): # Remove tmp_path
# Mock KaraokePrep methods
# Mock extract_artist_title_from_dir_name to avoid needing real directory
# mocker.patch(\'karaoke_prep.karaoke_prep.KaraokePrep.extract_artist_title_from_dir_name\', return_value=(artist, title)) # REMOVED - Logic is in gen_cli
# mocker.patch(\'karaoke_gen.karaoke_gen.KaraokePrep.extract_artist_title_from_dir_name\', return_value=(artist, title)) # REMOVED - Logic is in gen_cli
# Mock the process method entirely or spy on __init__ and process
prep_init_spy = mocker.spy(KaraokePrep, '__init__')
# Mock the process method to avoid its internal logic, return a dummy result
@@ -57,7 +58,7 @@ async def test_cli_edit_lyrics_integration(mocker): # Remove tmp_path
# Mock LyricsProcessor (part of KaraokePrep, but good to ensure it\'s called)
# Mock transcribe_lyrics to return dummy data needed by KaraokePrep mock result
# mock_transcribe = mocker.patch( # REMOVED - Not needed as KaraokePrep.process is mocked
# \'karaoke_prep.lyrics_processor.LyricsProcessor.transcribe_lyrics\',
# \'karaoke_gen.lyrics_processor.LyricsProcessor.transcribe_lyrics\',
# new_callable=AsyncMock, # Make it async
# return_value={
# \'corrected_lyrics_text\': \'Edited lyrics line 1\\nEdited lyrics line 2\',
@@ -70,7 +71,7 @@ async def test_cli_edit_lyrics_integration(mocker): # Remove tmp_path
# Mock KaraokeFinalise methods
# Mock detect_best_aac_codec called during __init__ to avoid os.popen
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.detect_best_aac_codec', return_value='aac_at')
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.detect_best_aac_codec', return_value='aac_at')
finalise_init_spy = mocker.spy(KaraokeFinalise, '__init__')
# Mock the process method to avoid its internal logic, provide a more complete return dict
mock_finalise_result = {
@@ -128,14 +129,14 @@ async def test_cli_edit_lyrics_integration(mocker): # Remove tmp_path
mocker.patch('googleapiclient.discovery.build', return_value=MagicMock())
mocker.patch('google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file', MagicMock())
# Mock specific finalise methods related to external APIs
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_youtube', return_value=MagicMock())
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.check_if_video_title_exists_on_youtube_channel', return_value='existing_video_id') # Crucial for replace logic
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.upload_final_mp4_to_youtube_with_title_thumbnail', MagicMock())
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_gmail', return_value=MagicMock())
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.draft_completion_email', MagicMock())
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.post_discord_notification', MagicMock())
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.sync_public_share_dir_to_rclone_destination', MagicMock())
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.generate_organised_folder_sharing_link', return_value="https://fake.sharing.link/mock_edit_folder")
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_youtube', return_value=MagicMock())
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.check_if_video_title_exists_on_youtube_channel', return_value='existing_video_id') # Crucial for replace logic
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.upload_final_mp4_to_youtube_with_title_thumbnail', MagicMock())
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_gmail', return_value=MagicMock())
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.draft_completion_email', MagicMock())
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.post_discord_notification', MagicMock())
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.sync_public_share_dir_to_rclone_destination', MagicMock())
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.generate_organised_folder_sharing_link', return_value="https://fake.sharing.link/mock_edit_folder")
# Mock pydub
mocker.patch('pydub.AudioSegment.from_file', return_value=MagicMock(duration_seconds=10)) # Need duration
@@ -5,13 +5,13 @@ import shutil
import subprocess
import sys
import json
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
from unittest.mock import MagicMock, call, patch, AsyncMock, ANY
from karaoke_prep.utils.gen_cli import async_main
from karaoke_gen.utils.gen_cli import async_main
import shlex
import asyncio
from googleapiclient.http import MediaFileUpload
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
# Register the asyncio marker
pytest.mark.asyncio = pytest.mark.asyncio
@@ -21,7 +21,8 @@ pytest_configure = lambda config: config.addinivalue_line("markers", "asyncio: m
@pytest.mark.asyncio
async def test_karaoke_prep_integration():
@pytest.mark.integration
async def test_karaoke_gen_integration():
# Create a temporary directory for test outputs
with tempfile.TemporaryDirectory() as temp_dir:
# Create a dummy input file (e.g., a small WAV file)
@@ -73,8 +74,8 @@ async def test_karaoke_prep_integration():
return None # Indicate failure
# Mock external dependencies and handler methods
with patch('karaoke_prep.metadata.extract_info_for_online_media') as mock_extract, \
patch('karaoke_prep.metadata.parse_track_metadata') as mock_parse, \
with patch('karaoke_gen.metadata.extract_info_for_online_media') as mock_extract, \
patch('karaoke_gen.metadata.parse_track_metadata') as mock_parse, \
patch.object(kp.file_handler, 'setup_output_paths', return_value=(os.path.join(temp_dir, "Test Artist - Test Title"), "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(kp.file_handler, 'copy_input_media', return_value="copied.mp4") as mock_copy, \
patch.object(kp.file_handler, 'convert_to_wav', side_effect=create_dummy_wav) as mock_convert, \
@@ -149,6 +150,7 @@ async def test_karaoke_prep_integration():
@pytest.mark.asyncio
@pytest.mark.integration
@pytest.mark.slow
async def test_full_cli_integration(tmp_path, mocker):
"""Tests the full CLI workflow by calling async_main directly with mocked sys.argv."""
@@ -191,7 +193,7 @@ async def test_full_cli_integration(tmp_path, mocker):
print(f"Warning: Background image {source_image} not found, skipping")
# Copy font file to /tmp directory
font_source = "karaoke_prep/resources/AvenirNext-Bold.ttf"
font_source = "karaoke_gen/resources/AvenirNext-Bold.ttf"
font_dest = "/tmp/AvenirNext-Bold.ttf"
if os.path.exists(font_source):
shutil.copy2(font_source, font_dest)
@@ -231,10 +233,10 @@ async def test_full_cli_integration(tmp_path, mocker):
# Mock YouTube credential flow and existing video check
mocker.patch('google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file')
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.check_if_video_title_exists_on_youtube_channel', return_value=False)
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.check_if_video_title_exists_on_youtube_channel', return_value=False)
# Mock the upload_final_mp4_to_youtube_with_title_thumbnail method to directly return mock_video_id to bypass YouTube API issues
mock_upload = mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.upload_final_mp4_to_youtube_with_title_thumbnail')
mock_upload = mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.upload_final_mp4_to_youtube_with_title_thumbnail')
# Set video_id and url attributes that would normally be set during upload
def side_effect(*args, **kwargs):
instance = args[0] # First arg is self
@@ -243,10 +245,10 @@ async def test_full_cli_integration(tmp_path, mocker):
mock_upload.side_effect = side_effect
# Keep the authenticate_youtube mock to return the service
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_youtube', return_value=mock_youtube_service)
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_youtube', return_value=mock_youtube_service)
# Mock Gmail API (reuse youtube mock for simplicity, just check call)
mocker.patch('karaoke_prep.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_gmail', return_value=mock_youtube_service)
mocker.patch('karaoke_gen.karaoke_finalise.karaoke_finalise.KaraokeFinalise.authenticate_gmail', return_value=mock_youtube_service)
mock_draft_create = MagicMock()
mock_draft_create.execute.return_value = {'id': 'mock_draft_id'}
mock_youtube_service.users().drafts().create.return_value = mock_draft_create
+6 -6
View File
@@ -3,7 +3,7 @@ import pytest
import tempfile
import logging
from unittest.mock import MagicMock
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
import inspect
@pytest.fixture
@@ -23,19 +23,19 @@ def temp_dir():
yield temp_dir
@pytest.fixture
def basic_karaoke_prep(mock_logger, mock_ffmpeg):
def basic_karaoke_gen(mock_logger, mock_ffmpeg):
"""Return a basic KaraokePrep instance for testing."""
with MagicMock() as mock_os_system:
# Create a KaraokePrep instance with a mock logger
karaoke_prep = KaraokePrep(logger=mock_logger)
karaoke_gen = KaraokePrep(logger=mock_logger)
# Replace the ffmpeg_base_command with a mock
karaoke_prep.ffmpeg_base_command = "mock_ffmpeg"
karaoke_gen.ffmpeg_base_command = "mock_ffmpeg"
# Mock os.system to avoid executing commands
karaoke_prep._os_system = mock_os_system
karaoke_gen._os_system = mock_os_system
yield karaoke_prep
yield karaoke_gen
def pytest_collection_modifyitems(items):
"""Mark async tests with asyncio marker."""
+1 -1
View File
@@ -10,7 +10,7 @@ if __name__ == "__main__":
# Run pytest with coverage
sys.exit(pytest.main([
"--cov=karaoke_prep",
"--cov=karaoke_gen",
"--cov-report=term",
"-v",
os.path.dirname(__file__)
+137 -137
View File
@@ -4,30 +4,30 @@ import asyncio
import signal
import sys
from unittest.mock import MagicMock, patch, AsyncMock, ANY
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
class TestAsync:
@pytest.mark.asyncio
async def test_prep_single_track(self, basic_karaoke_prep, temp_dir):
async def test_prep_single_track(self, basic_karaoke_gen, temp_dir):
"""Test the main prep_single_track workflow."""
# Mock dependencies for file handling
# Patch the handler methods
with patch.object(basic_karaoke_prep.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_prep.file_handler, 'copy_input_media', return_value=os.path.join(temp_dir, "copied.mp4")) as mock_copy, \
patch.object(basic_karaoke_prep.file_handler, 'convert_to_wav', return_value=os.path.join(temp_dir, "converted.wav")) as mock_convert, \
patch.object(basic_karaoke_prep.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_prep.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_prep.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_prep.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_prep.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
with patch.object(basic_karaoke_gen.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_gen.file_handler, 'copy_input_media', return_value=os.path.join(temp_dir, "copied.mp4")) as mock_copy, \
patch.object(basic_karaoke_gen.file_handler, 'convert_to_wav', return_value=os.path.join(temp_dir, "converted.wav")) as mock_convert, \
patch.object(basic_karaoke_gen.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_gen.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_gen.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_gen.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_gen.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
basic_karaoke_prep.input_media = os.path.join(temp_dir, "input.mp4")
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.output_dir = temp_dir
basic_karaoke_gen.input_media = os.path.join(temp_dir, "input.mp4")
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.output_dir = temp_dir
# Create mock input file
with open(basic_karaoke_prep.input_media, "w") as f:
with open(basic_karaoke_gen.input_media, "w") as f:
f.write("mock video content")
# Configure mock asyncio.gather to return mock results
@@ -63,7 +63,7 @@ class TestAsync:
# No need to mock future.result, the function returns the dict directly
# Call the method
result = await basic_karaoke_prep.prep_single_track()
result = await basic_karaoke_gen.prep_single_track()
# Verify the result structure
assert result is not None
@@ -83,28 +83,28 @@ class TestAsync:
assert mock_separate.call_count >= 1
@pytest.mark.asyncio
async def test_prep_single_track_with_url(self, basic_karaoke_prep):
async def test_prep_single_track_with_url(self, basic_karaoke_gen):
"""Test preparing a single track with a URL."""
# Setup
basic_karaoke_prep.input_media = "https://example.com/video"
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.url = "https://example.com/video" # Explicitly set URL
basic_karaoke_prep.extractor = "youtube" # Explicitly set extractor
basic_karaoke_prep.media_id = "12345" # Explicitly set media_id
basic_karaoke_gen.input_media = "https://example.com/video"
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.url = "https://example.com/video" # Explicitly set URL
basic_karaoke_gen.extractor = "youtube" # Explicitly set extractor
basic_karaoke_gen.media_id = "12345" # Explicitly set media_id
# Mock dependencies
with patch('karaoke_prep.metadata.extract_info_for_online_media') as mock_extract, \
patch('karaoke_prep.metadata.parse_track_metadata') as mock_parse, \
patch.object(basic_karaoke_prep.file_handler, 'setup_output_paths', return_value=("output_dir", "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_prep.file_handler, 'download_video', return_value="downloaded_file.mp4") as mock_download, \
patch.object(basic_karaoke_prep.file_handler, 'extract_still_image_from_video', return_value="still_image.png") as mock_extract_image, \
patch.object(basic_karaoke_prep.file_handler, 'convert_to_wav', return_value="output.wav") as mock_convert, \
patch.object(basic_karaoke_prep.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_prep.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_prep.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_prep.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_prep.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
with patch('karaoke_gen.metadata.extract_info_for_online_media') as mock_extract, \
patch('karaoke_gen.metadata.parse_track_metadata') as mock_parse, \
patch.object(basic_karaoke_gen.file_handler, 'setup_output_paths', return_value=("output_dir", "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_gen.file_handler, 'download_video', return_value="downloaded_file.mp4") as mock_download, \
patch.object(basic_karaoke_gen.file_handler, 'extract_still_image_from_video', return_value="still_image.png") as mock_extract_image, \
patch.object(basic_karaoke_gen.file_handler, 'convert_to_wav', return_value="output.wav") as mock_convert, \
patch.object(basic_karaoke_gen.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_gen.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_gen.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_gen.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_gen.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
# Configure mock asyncio.gather to return mock results
mock_separate.return_value = {}
@@ -140,7 +140,7 @@ class TestAsync:
# No need to mock future.result, the function returns the dict directly
# Call the method
result = await basic_karaoke_prep.prep_single_track()
result = await basic_karaoke_gen.prep_single_track()
# Verify the result structure
assert result is not None
@@ -156,35 +156,35 @@ class TestAsync:
# assert result["extractor"].lower() == mock_future.return_value["extractor"].lower() # Case-insensitive compare
@pytest.mark.asyncio
async def test_prep_single_track_with_existing_files(self, basic_karaoke_prep, temp_dir):
async def test_prep_single_track_with_existing_files(self, basic_karaoke_gen, temp_dir):
"""Test preparing a single track when files already exist."""
# Setup
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.output_dir = temp_dir
basic_karaoke_prep.extractor = "ExistingExtractor" # Explicitly set extractor for existing files case
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.output_dir = temp_dir
basic_karaoke_gen.extractor = "ExistingExtractor" # Explicitly set extractor for existing files case
# Mock dependencies
# Define side effect for glob.glob
def glob_side_effect(pattern):
artist_title = f"{basic_karaoke_prep.artist} - {basic_karaoke_prep.title}"
expected_base = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor}*)")
artist_title = f"{basic_karaoke_gen.artist} - {basic_karaoke_gen.title}"
expected_base = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor}*)")
# Check if the pattern matches the expected base for webm, png, or wav
if pattern == f"{expected_base}.*webm" or pattern == f"{expected_base}.*mp4":
# Return a filename that matches the extractor pattern conceptually
return [os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor} MockID).webm")]
return [os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor} MockID).webm")]
elif pattern == f"{expected_base}.png":
return [os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor} MockID).png")]
return [os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor} MockID).png")]
elif pattern == f"{expected_base}.wav":
return [os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor} MockID).wav")]
return [os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor} MockID).wav")]
return []
with patch.object(basic_karaoke_prep.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
with patch.object(basic_karaoke_gen.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch('glob.glob', side_effect=glob_side_effect), \
patch.object(basic_karaoke_prep.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_prep.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_prep.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_prep.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
patch.object(basic_karaoke_gen.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_gen.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_gen.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_gen.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
# Configure mock asyncio.gather to return mock results
mock_separate.return_value = {}
@@ -215,7 +215,7 @@ class TestAsync:
# No need to mock future.result, the function returns the dict directly
# Call the method
result = await basic_karaoke_prep.prep_single_track()
result = await basic_karaoke_gen.prep_single_track()
# Verify the result structure
assert result is not None
@@ -223,41 +223,41 @@ class TestAsync:
assert result["title"] == mock_future.return_value["title"]
# Construct the expected filenames based on the mock logic
artist_title = f"{basic_karaoke_prep.artist} - {basic_karaoke_prep.title}"
expected_media_path = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor} MockID).webm")
expected_image_path = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor} MockID).png")
expected_wav_path = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_prep.extractor} MockID).wav")
artist_title = f"{basic_karaoke_gen.artist} - {basic_karaoke_gen.title}"
expected_media_path = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor} MockID).webm")
expected_image_path = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor} MockID).png")
expected_wav_path = os.path.join(temp_dir, f"{artist_title} ({basic_karaoke_gen.extractor} MockID).wav")
assert result["input_media"] == expected_media_path
assert result["input_still_image"] == expected_image_path
assert result["input_audio_wav"] == expected_wav_path
if not isinstance(result["separated_audio"], asyncio.futures.Future) and not asyncio.iscoroutine(result["separated_audio"]):
assert result["separated_audio"] == mock_future.return_value["separated_audio"]
assert result["extractor"] == basic_karaoke_prep.extractor # Should match the one we set
assert result["extractor"] == basic_karaoke_gen.extractor # Should match the one we set
@pytest.mark.asyncio
async def test_prep_single_track_skip_lyrics(self, basic_karaoke_prep, temp_dir):
async def test_prep_single_track_skip_lyrics(self, basic_karaoke_gen, temp_dir):
"""Test preparing a single track with skip_lyrics=True."""
# Setup
basic_karaoke_prep.input_media = os.path.join(temp_dir, "input.mp4")
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.output_dir = temp_dir
basic_karaoke_prep.skip_lyrics = True
basic_karaoke_gen.input_media = os.path.join(temp_dir, "input.mp4")
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.output_dir = temp_dir
basic_karaoke_gen.skip_lyrics = True
# Create mock input file
with open(basic_karaoke_prep.input_media, "w") as f:
with open(basic_karaoke_gen.input_media, "w") as f:
f.write("mock video content")
# Mock dependencies
with patch.object(basic_karaoke_prep.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_prep.file_handler, 'copy_input_media', return_value=os.path.join(temp_dir, "copied.mp4")) as mock_copy, \
patch.object(basic_karaoke_prep.file_handler, 'convert_to_wav', return_value=os.path.join(temp_dir, "converted.wav")) as mock_convert, \
patch.object(basic_karaoke_prep.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_prep.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_prep.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_prep.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_prep.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
with patch.object(basic_karaoke_gen.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_gen.file_handler, 'copy_input_media', return_value=os.path.join(temp_dir, "copied.mp4")) as mock_copy, \
patch.object(basic_karaoke_gen.file_handler, 'convert_to_wav', return_value=os.path.join(temp_dir, "converted.wav")) as mock_convert, \
patch.object(basic_karaoke_gen.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_gen.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_gen.audio_processor, 'process_audio_separation', AsyncMock(return_value={'instrumental': 'inst.flac'})) as mock_separate, \
patch.object(basic_karaoke_gen.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_gen.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
# Mock the return value of prep_single_track
expected_result = {
@@ -281,7 +281,7 @@ class TestAsync:
}
# Call the method
result = await basic_karaoke_prep.prep_single_track()
result = await basic_karaoke_gen.prep_single_track()
# Verify the result structure
assert result is not None
@@ -296,27 +296,27 @@ class TestAsync:
mock_transcribe.assert_not_called() # Verify lyrics was skipped
@pytest.mark.asyncio
async def test_prep_single_track_skip_separation(self, basic_karaoke_prep, temp_dir):
async def test_prep_single_track_skip_separation(self, basic_karaoke_gen, temp_dir):
"""Test preparing a single track with skip_separation=True."""
# Setup
basic_karaoke_prep.input_media = os.path.join(temp_dir, "input.mp4")
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.output_dir = temp_dir
basic_karaoke_prep.skip_separation = True
basic_karaoke_gen.input_media = os.path.join(temp_dir, "input.mp4")
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.output_dir = temp_dir
basic_karaoke_gen.skip_separation = True
# Create mock input file
with open(basic_karaoke_prep.input_media, "w") as f:
with open(basic_karaoke_gen.input_media, "w") as f:
f.write("mock video content")
# Mock dependencies
with patch.object(basic_karaoke_prep.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_prep.file_handler, 'copy_input_media', return_value=os.path.join(temp_dir, "copied.mp4")) as mock_copy, \
patch.object(basic_karaoke_prep.file_handler, 'convert_to_wav', return_value=os.path.join(temp_dir, "converted.wav")) as mock_convert, \
patch.object(basic_karaoke_prep.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_prep.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_prep.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_prep.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
with patch.object(basic_karaoke_gen.file_handler, 'setup_output_paths', return_value=(temp_dir, "Test Artist - Test Title")) as mock_setup_paths, \
patch.object(basic_karaoke_gen.file_handler, 'copy_input_media', return_value=os.path.join(temp_dir, "copied.mp4")) as mock_copy, \
patch.object(basic_karaoke_gen.file_handler, 'convert_to_wav', return_value=os.path.join(temp_dir, "converted.wav")) as mock_convert, \
patch.object(basic_karaoke_gen.file_handler, '_file_exists', return_value=False) as mock_file_exists, \
patch.object(basic_karaoke_gen.lyrics_processor, 'transcribe_lyrics', AsyncMock(return_value={'lrc_filepath': 'lyrics.lrc'})) as mock_transcribe, \
patch.object(basic_karaoke_gen.video_generator, 'create_title_video', MagicMock()) as mock_create_title, \
patch.object(basic_karaoke_gen.video_generator, 'create_end_video', MagicMock()) as mock_create_end:
# Conditionally patch separation only if we expect it to run (it's skipped here)
# We will assert on the actual method instance later
@@ -354,7 +354,7 @@ class TestAsync:
}
# Call the method
result = await basic_karaoke_prep.prep_single_track()
result = await basic_karaoke_gen.prep_single_track()
# Verify the result structure
assert result is not None
@@ -365,7 +365,7 @@ class TestAsync:
assert result["separated_audio"] == expected_result["separated_audio"]
# Assert that the actual separation method was NOT called
# To do this, we need to spy on the actual method without replacing it
with patch.object(basic_karaoke_prep.audio_processor, 'process_audio_separation', wraps=basic_karaoke_prep.audio_processor.process_audio_separation) as spy_separate:
with patch.object(basic_karaoke_gen.audio_processor, 'process_audio_separation', wraps=basic_karaoke_gen.audio_processor.process_audio_separation) as spy_separate:
# Re-run the call within the spy context if necessary, or check previous state
# For simplicity, let's assume the state check is sufficient if the previous run didn't error
spy_separate.assert_not_called()
@@ -374,7 +374,7 @@ class TestAsync:
assert mock_transcribe.call_count > 0
@pytest.mark.asyncio
async def test_shutdown(self, basic_karaoke_prep):
async def test_shutdown(self, basic_karaoke_gen):
"""Test the shutdown signal handler."""
# Mock signal
mock_signal = MagicMock()
@@ -394,36 +394,36 @@ class TestAsync:
patch('sys.exit') as mock_exit:
# Mock the shutdown method to do nothing
with patch.object(basic_karaoke_prep, 'shutdown') as mock_shutdown:
with patch.object(basic_karaoke_gen, 'shutdown') as mock_shutdown:
# Call the method
await basic_karaoke_prep.shutdown(mock_signal)
await basic_karaoke_gen.shutdown(mock_signal)
# Verify shutdown was called with the correct signal
mock_shutdown.assert_called_once_with(mock_signal)
@pytest.mark.asyncio
async def test_process_playlist(self, basic_karaoke_prep):
async def test_process_playlist(self, basic_karaoke_gen):
"""Test processing a playlist."""
# Setup
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.extracted_info = {
"entries": [
{"title": "Track 1"},
{"title": "Track 2"}
]
}
basic_karaoke_prep.persistent_artist = "Test Artist"
basic_karaoke_gen.persistent_artist = "Test Artist"
# Mock prep_single_track
with patch.object(basic_karaoke_prep, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
with patch.object(basic_karaoke_gen, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
mock_prep_single_track.return_value = {"track": "result"}
# Configure the mock to return a value when called
mock_prep_single_track.return_value = {"track": "result"}
# Call the method directly instead of awaiting it
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"entries": [
{"title": "Track 1"},
{"title": "Track 2"}
@@ -434,7 +434,7 @@ class TestAsync:
expected_result = [{"track": "result1"}, {"track": "result2"}]
# Call the method
result = await basic_karaoke_prep.process_playlist()
result = await basic_karaoke_gen.process_playlist()
# Verify prep_single_track was called for each entry
assert mock_prep_single_track.call_count == 2
@@ -445,24 +445,24 @@ class TestAsync:
assert result[1] == {"track": "result"}
@pytest.mark.asyncio
async def test_process_playlist_error(self, basic_karaoke_prep):
async def test_process_playlist_error(self, basic_karaoke_gen):
"""Test processing a playlist with an error."""
# Setup
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_prep.extracted_info = {} # Missing entries
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
basic_karaoke_gen.extracted_info = {} # Missing entries
# Test
with pytest.raises(Exception, match="Failed to find 'entries' in playlist, cannot process"):
await basic_karaoke_prep.process_playlist()
await basic_karaoke_gen.process_playlist()
@pytest.mark.asyncio
async def test_process_folder(self, basic_karaoke_prep, temp_dir):
async def test_process_folder(self, basic_karaoke_gen, temp_dir):
"""Test processing a folder."""
# Setup
basic_karaoke_prep.input_media = temp_dir
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.filename_pattern = r"(?P<index>\d+)_(?P<title>.+)\.mp3"
basic_karaoke_gen.input_media = temp_dir
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.filename_pattern = r"(?P<index>\d+)_(?P<title>.+)\.mp3"
# Create mock files
os.makedirs(temp_dir, exist_ok=True)
@@ -472,7 +472,7 @@ class TestAsync:
f.write("mock audio content")
# Mock dependencies
with patch.object(basic_karaoke_prep, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track, \
with patch.object(basic_karaoke_gen, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track, \
patch('os.makedirs'), \
patch('shutil.move'):
@@ -486,7 +486,7 @@ class TestAsync:
]
# Call the method
result = await basic_karaoke_prep.process_folder()
result = await basic_karaoke_gen.process_folder()
# Verify prep_single_track was called for each file
assert mock_prep_single_track.call_count == 2
@@ -495,34 +495,34 @@ class TestAsync:
assert len(result) == 2
@pytest.mark.asyncio
async def test_process_folder_error(self, basic_karaoke_prep):
async def test_process_folder_error(self, basic_karaoke_gen):
"""Test processing a folder with an error."""
# Setup
basic_karaoke_prep.input_media = "folder"
basic_karaoke_prep.artist = None # Missing artist
basic_karaoke_prep.filename_pattern = r"pattern"
basic_karaoke_gen.input_media = "folder"
basic_karaoke_gen.artist = None # Missing artist
basic_karaoke_gen.filename_pattern = r"pattern"
# Test
with pytest.raises(Exception, match="Error: Filename pattern and artist are required for processing a folder"):
await basic_karaoke_prep.process_folder()
await basic_karaoke_gen.process_folder()
@pytest.mark.asyncio
async def test_process_local_file(self, basic_karaoke_prep, temp_dir):
async def test_process_local_file(self, basic_karaoke_gen, temp_dir):
"""Test processing a local file."""
# Setup
input_file = os.path.join(temp_dir, "input.mp3")
with open(input_file, "w") as f:
f.write("mock audio content")
basic_karaoke_prep.input_media = input_file
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_gen.input_media = input_file
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
# Mock dependencies
with patch.object(basic_karaoke_prep, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
with patch.object(basic_karaoke_gen, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
mock_prep_single_track.return_value = {"track": "result"}
result = await basic_karaoke_prep.process()
result = await basic_karaoke_gen.process()
# Verify prep_single_track was called
mock_prep_single_track.assert_called_once()
@@ -532,16 +532,16 @@ class TestAsync:
assert result[0] == {"track": "result"}
@pytest.mark.asyncio
async def test_process_online_media(self, basic_karaoke_prep):
async def test_process_online_media(self, basic_karaoke_gen):
"""Test processing online media."""
# Setup
basic_karaoke_prep.input_media = "https://example.com/video"
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_gen.input_media = "https://example.com/video"
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
# Mock dependencies
with patch('karaoke_prep.metadata.ydl') as mock_ydl, \
patch.object(basic_karaoke_prep, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
with patch('karaoke_gen.metadata.ydl') as mock_ydl, \
patch.object(basic_karaoke_gen, 'prep_single_track', new_callable=AsyncMock) as mock_prep_single_track:
# Configure the mock ydl context manager
mock_ydl_instance = MagicMock()
@@ -553,10 +553,10 @@ class TestAsync:
}
mock_ydl.return_value.__enter__.return_value = mock_ydl_instance
basic_karaoke_prep.extracted_info = {} # Not a playlist
basic_karaoke_gen.extracted_info = {} # Not a playlist
mock_prep_single_track.return_value = {"track": "result"}
result = await basic_karaoke_prep.process()
result = await basic_karaoke_gen.process()
# Verify prep_single_track was called
mock_prep_single_track.assert_called_once()
@@ -566,26 +566,26 @@ class TestAsync:
assert result[0] == {"track": "result"}
@pytest.mark.asyncio
async def test_process_online_playlist(self, basic_karaoke_prep):
async def test_process_online_playlist(self, basic_karaoke_gen):
"""Test processing an online playlist."""
# Setup
basic_karaoke_prep.input_media = "https://example.com/playlist"
basic_karaoke_prep.artist = "Test Artist"
basic_karaoke_prep.title = "Test Title"
basic_karaoke_gen.input_media = "https://example.com/playlist"
basic_karaoke_gen.artist = "Test Artist"
basic_karaoke_gen.title = "Test Title"
# Mock dependencies
with patch('karaoke_prep.metadata.ydl') as mock_ydl, \
patch.object(basic_karaoke_prep, 'process_playlist', new_callable=AsyncMock) as mock_process_playlist:
with patch('karaoke_gen.metadata.ydl') as mock_ydl, \
patch.object(basic_karaoke_gen, 'process_playlist', new_callable=AsyncMock) as mock_process_playlist:
# Configure the mock ydl context manager
mock_ydl_instance = MagicMock()
mock_ydl_instance.extract_info.return_value = {"playlist_count": 2}
mock_ydl.return_value.__enter__.return_value = mock_ydl_instance
basic_karaoke_prep.extracted_info = {"playlist_count": 2} # Is a playlist
basic_karaoke_gen.extracted_info = {"playlist_count": 2} # Is a playlist
mock_process_playlist.return_value = [{"track": "result1"}, {"track": "result2"}]
result = await basic_karaoke_prep.process()
result = await basic_karaoke_gen.process()
# Verify process_playlist was called
mock_process_playlist.assert_called_once()
+27 -27
View File
@@ -7,11 +7,11 @@ from unittest.mock import MagicMock, patch, call, mock_open
import datetime as dt # Use alias to avoid conflict
import fcntl
from pydub import AudioSegment
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
from audio_separator.separator import Separator # Keep for patching target
class TestAudio:
def test_separate_audio(self, basic_karaoke_prep, temp_dir):
def test_separate_audio(self, basic_karaoke_gen, temp_dir):
"""Test separating audio into instrumental and vocals."""
# Setup
audio_file = os.path.join(temp_dir, "input.wav")
@@ -38,7 +38,7 @@ class TestAudio:
patch('os.rename') as mock_rename:
# Call the method
basic_karaoke_prep.audio_processor.separate_audio(
basic_karaoke_gen.audio_processor.separate_audio(
audio_file=audio_file,
model_name=model_name,
artist_title=artist_title,
@@ -64,10 +64,10 @@ class TestAudio:
instrumental_path
)
def test_separate_audio_invalid_audio_file(self, basic_karaoke_prep):
def test_separate_audio_invalid_audio_file(self, basic_karaoke_gen):
"""Test separating audio with an invalid audio file."""
with pytest.raises(Exception, match="Error: Invalid audio source provided."):
basic_karaoke_prep.audio_processor.separate_audio(
basic_karaoke_gen.audio_processor.separate_audio(
audio_file=None,
model_name="test_model.ckpt",
artist_title="Test Artist - Test Title",
@@ -76,7 +76,7 @@ class TestAudio:
vocals_path="vocals.flac"
)
def test_process_audio_separation(self, basic_karaoke_prep, temp_dir):
def test_process_audio_separation(self, basic_karaoke_gen, temp_dir):
"""Test the process_audio_separation method."""
# Setup
audio_file = os.path.join(temp_dir, "input.wav")
@@ -103,23 +103,23 @@ class TestAudio:
# The input path for backing vocal separation is the output vocals from the clean separation
clean_vocals_output_path = os.path.join(stems_dir, f"{artist_title} (Vocals {clean_model}).flac")
# audio-separator appends _(Vocals) or _(Instrumental) to the *input* filename stem (without extension), relative to the input file's directory
clean_vocals_input_stem = clean_vocals_output_path[:-len(basic_karaoke_prep.lossless_output_format)-1] # Remove .flac
intermediate_bv_vocals = f"{clean_vocals_input_stem}_(Vocals).{basic_karaoke_prep.lossless_output_format}"
intermediate_bv_instrumental = f"{clean_vocals_input_stem}_(Instrumental).{basic_karaoke_prep.lossless_output_format}"
clean_vocals_input_stem = clean_vocals_output_path[:-len(basic_karaoke_gen.lossless_output_format)-1] # Remove .flac
intermediate_bv_vocals = f"{clean_vocals_input_stem}_(Vocals).{basic_karaoke_gen.lossless_output_format}"
intermediate_bv_instrumental = f"{clean_vocals_input_stem}_(Instrumental).{basic_karaoke_gen.lossless_output_format}"
mock_separator.separate.side_effect = [
# 1. Clean instrumental model outputs (called by _separate_clean_instrumental)
# These are output relative to the *input* audio file's directory (temp_dir)
[
# These names need the model name appended by the separator convention
os.path.join(temp_dir, f"{artist_title}_(Vocals)_{clean_model}.{basic_karaoke_prep.lossless_output_format}"),
os.path.join(temp_dir, f"{artist_title}_(Instrumental)_{clean_model}.{basic_karaoke_prep.lossless_output_format}")
os.path.join(temp_dir, f"{artist_title}_(Vocals)_{clean_model}.{basic_karaoke_gen.lossless_output_format}"),
os.path.join(temp_dir, f"{artist_title}_(Instrumental)_{clean_model}.{basic_karaoke_gen.lossless_output_format}")
],
# 2. Other stems model outputs (called by _separate_other_stems)
# These are also output relative to the *input* audio file's directory (temp_dir)
[
os.path.join(temp_dir, f"{artist_title}_(Piano)_{other_model}.{basic_karaoke_prep.lossless_output_format}"),
os.path.join(temp_dir, f"{artist_title}_(Guitar)_{other_model}.{basic_karaoke_prep.lossless_output_format}")
os.path.join(temp_dir, f"{artist_title}_(Piano)_{other_model}.{basic_karaoke_gen.lossless_output_format}"),
os.path.join(temp_dir, f"{artist_title}_(Guitar)_{other_model}.{basic_karaoke_gen.lossless_output_format}")
],
# 3. Backing vocals model outputs (called by _separate_backing_vocals)
# These are output relative to the *vocals input* file's directory (stems_dir)
@@ -140,8 +140,8 @@ class TestAudio:
patch('os.remove'), \
patch('os.system'), \
patch('builtins.open', mock_open(read_data='{"pid": 123, "start_time": "2023-01-01T11:00:00", "track": "Old Track"}')) as mock_file_open, \
patch.object(basic_karaoke_prep.audio_processor, '_normalize_audio_files') as mock_normalize_files, \
patch.object(basic_karaoke_prep.file_handler, '_file_exists') as mock_file_exists:
patch.object(basic_karaoke_gen.audio_processor, '_normalize_audio_files') as mock_normalize_files, \
patch.object(basic_karaoke_gen.file_handler, '_file_exists') as mock_file_exists:
# Configure _file_exists side effect: False initially, then True for normalization checks
# Needs to return False for:
@@ -166,7 +166,7 @@ class TestAudio:
mock_datetime.fromisoformat.side_effect = lambda *args, **kwargs: dt.datetime.fromisoformat(*args, **kwargs)
# Call the method
result = basic_karaoke_prep.audio_processor.process_audio_separation(
result = basic_karaoke_gen.audio_processor.process_audio_separation(
audio_file=audio_file,
artist_title=artist_title,
track_output_dir=track_output_dir
@@ -187,8 +187,8 @@ class TestAudio:
# Verify _normalize_audio_files was called once
assert mock_normalize_files.call_count == 1
def test_process_audio_separation_with_skip_env_var(self, basic_karaoke_prep, temp_dir):
"""Test process_audio_separation with KARAOKE_PREP_SKIP_AUDIO_SEPARATION environment variable."""
def test_process_audio_separation_with_skip_env_var(self, basic_karaoke_gen, temp_dir):
"""Test process_audio_separation with KARAOKE_GEN_SKIP_AUDIO_SEPARATION environment variable."""
# Setup
audio_file = os.path.join(temp_dir, "input.wav")
with open(audio_file, "w") as f:
@@ -198,12 +198,12 @@ class TestAudio:
track_output_dir = temp_dir
# Mock environment variable
with patch.dict('os.environ', {'KARAOKE_PREP_SKIP_AUDIO_SEPARATION': '1'}), \
with patch.dict('os.environ', {'KARAOKE_GEN_SKIP_AUDIO_SEPARATION': '1'}), \
patch('fcntl.flock'), \
patch('builtins.open', mock_open()) as mock_file_open:
# Call the method
result = basic_karaoke_prep.audio_processor.process_audio_separation(
result = basic_karaoke_gen.audio_processor.process_audio_separation(
audio_file=audio_file,
artist_title=artist_title,
track_output_dir=track_output_dir
@@ -221,7 +221,7 @@ class TestAudio:
assert result["backing_vocals"] == {}
assert result["combined_instrumentals"] == {}
def test_normalize_audio(self, basic_karaoke_prep, temp_dir):
def test_normalize_audio(self, basic_karaoke_gen, temp_dir):
"""Test normalizing audio."""
# Setup
input_path = os.path.join(temp_dir, "input.flac")
@@ -236,7 +236,7 @@ class TestAudio:
# Mock dependencies
with patch('pydub.AudioSegment.from_file', return_value=mock_audio):
# Call the method
basic_karaoke_prep.audio_processor._normalize_audio(input_path, output_path)
basic_karaoke_gen.audio_processor._normalize_audio(input_path, output_path)
# Verify AudioSegment.from_file was called with correct arguments
AudioSegment.from_file.assert_called_once_with(input_path, format="flac")
@@ -247,7 +247,7 @@ class TestAudio:
# Verify export was called with correct arguments
mock_audio.export.assert_called_once_with(output_path, format="flac")
def test_normalize_audio_silent_result(self, basic_karaoke_prep, temp_dir):
def test_normalize_audio_silent_result(self, basic_karaoke_gen, temp_dir):
"""Test normalizing audio when the result would be silent."""
# Setup
input_path = os.path.join(temp_dir, "input.flac")
@@ -266,7 +266,7 @@ class TestAudio:
# Mock dependencies
with patch('pydub.AudioSegment.from_file', return_value=mock_audio):
# Call the method
basic_karaoke_prep.audio_processor._normalize_audio(input_path, output_path)
basic_karaoke_gen.audio_processor._normalize_audio(input_path, output_path)
# Verify AudioSegment.from_file was called with correct arguments
AudioSegment.from_file.assert_called_once_with(input_path, format="flac")
@@ -277,12 +277,12 @@ class TestAudio:
# Verify export was called with the original audio (not the silent one)
mock_audio.export.assert_called_once_with(output_path, format="flac")
def test_file_exists(self, basic_karaoke_prep):
def test_file_exists(self, basic_karaoke_gen):
"""Test the _file_exists helper method."""
# Test with existing file
with patch('os.path.isfile', return_value=True):
assert basic_karaoke_prep.file_handler._file_exists("existing_file.txt") is True
assert basic_karaoke_gen.file_handler._file_exists("existing_file.txt") is True
# Test with non-existing file
with patch('os.path.isfile', return_value=False):
assert basic_karaoke_prep.file_handler._file_exists("non_existing_file.txt") is False
assert basic_karaoke_gen.file_handler._file_exists("non_existing_file.txt") is False
+70 -70
View File
@@ -8,28 +8,28 @@ import json
from unittest.mock import patch, MagicMock, AsyncMock, mock_open, call
# Import the module/functions to test
from karaoke_prep.utils import bulk_cli
from karaoke_gen.utils import bulk_cli
# Define module paths to mock consistently across tests
mock_module_paths = {
"KaraokePrep": "karaoke_prep.utils.bulk_cli.KaraokePrep",
"KaraokeFinalise": "karaoke_prep.utils.bulk_cli.KaraokeFinalise",
"os_path_isfile": "karaoke_prep.utils.bulk_cli.os.path.isfile",
"os_path_exists": "karaoke_prep.utils.bulk_cli.os.path.exists",
"os_chdir": "karaoke_prep.utils.bulk_cli.os.chdir",
"os_getcwd": "karaoke_prep.utils.bulk_cli.os.getcwd",
"KaraokePrep": "karaoke_gen.utils.bulk_cli.KaraokePrep",
"KaraokeFinalise": "karaoke_gen.utils.bulk_cli.KaraokeFinalise",
"os_path_isfile": "karaoke_gen.utils.bulk_cli.os.path.isfile",
"os_path_exists": "karaoke_gen.utils.bulk_cli.os.path.exists",
"os_chdir": "karaoke_gen.utils.bulk_cli.os.chdir",
"os_getcwd": "karaoke_gen.utils.bulk_cli.os.getcwd",
"open_func": "builtins.open",
"csv_DictReader": "karaoke_prep.utils.bulk_cli.csv.DictReader",
"csv_DictWriter": "karaoke_prep.utils.bulk_cli.csv.DictWriter",
"update_csv_status": "karaoke_prep.utils.bulk_cli.update_csv_status",
"ArgumentParser": "karaoke_prep.utils.bulk_cli.argparse.ArgumentParser",
"os_path_abspath": "karaoke_prep.utils.bulk_cli.os.path.abspath",
"sys_exit": "karaoke_prep.utils.bulk_cli.sys.exit",
"asyncio_run": "karaoke_prep.utils.bulk_cli.asyncio.run",
"logger": "karaoke_prep.utils.bulk_cli.logger",
"getattr_func": "karaoke_prep.utils.bulk_cli.getattr",
"StreamHandler": "karaoke_prep.utils.bulk_cli.logging.StreamHandler",
"Formatter": "karaoke_prep.utils.bulk_cli.logging.Formatter"
"csv_DictReader": "karaoke_gen.utils.bulk_cli.csv.DictReader",
"csv_DictWriter": "karaoke_gen.utils.bulk_cli.csv.DictWriter",
"update_csv_status": "karaoke_gen.utils.bulk_cli.update_csv_status",
"ArgumentParser": "karaoke_gen.utils.bulk_cli.argparse.ArgumentParser",
"os_path_abspath": "karaoke_gen.utils.bulk_cli.os.path.abspath",
"sys_exit": "karaoke_gen.utils.bulk_cli.sys.exit",
"asyncio_run": "karaoke_gen.utils.bulk_cli.asyncio.run",
"logger": "karaoke_gen.utils.bulk_cli.logger",
"getattr_func": "karaoke_gen.utils.bulk_cli.getattr",
"StreamHandler": "karaoke_gen.utils.bulk_cli.logging.StreamHandler",
"Formatter": "karaoke_gen.utils.bulk_cli.logging.Formatter"
}
# Instead of the global pytestmark, we'll explicitly mark async tests where needed
@@ -85,11 +85,11 @@ def mock_log_formatter():
return MagicMock(spec=logging.Formatter)
# Add mocks for the new helper functions and process_csv_rows
@patch("karaoke_prep.utils.bulk_cli.process_csv_rows", new_callable=AsyncMock)
@patch("karaoke_prep.utils.bulk_cli._read_csv_file")
@patch("karaoke_prep.utils.bulk_cli._parse_and_validate_args")
@patch("karaoke_prep.utils.bulk_cli.setup_logging") # Mock logging setup as well
@patch("karaoke_prep.utils.bulk_cli.logger") # Mock the module-level logger directly
@patch("karaoke_gen.utils.bulk_cli.process_csv_rows", new_callable=AsyncMock)
@patch("karaoke_gen.utils.bulk_cli._read_csv_file")
@patch("karaoke_gen.utils.bulk_cli._parse_and_validate_args")
@patch("karaoke_gen.utils.bulk_cli.setup_logging") # Mock logging setup as well
@patch("karaoke_gen.utils.bulk_cli.logger") # Mock the module-level logger directly
@pytest.mark.asyncio # Explicitly mark as async test
async def test_async_main_flow(
mock_bulk_cli_logger, mock_setup_logging, mock_parse_args, mock_read_csv, mock_process_rows, # Added mock_bulk_cli_logger back
@@ -144,9 +144,9 @@ async def test_async_main_flow(
assert result == {"summary": "results"}
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_prep_success(mock_getcwd, mock_chdir, mock_kprep, mock_args, mock_logger, mock_log_formatter):
"""Test process_track_prep successfully calls KaraokePrep."""
@@ -174,9 +174,9 @@ async def test_process_track_prep_success(mock_getcwd, mock_chdir, mock_kprep, m
mock_chdir.assert_called_once_with("/fake/original/dir") # Changed back at the end
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_prep_failure(mock_getcwd, mock_chdir, mock_kprep, mock_args, mock_logger, mock_log_formatter):
"""Test process_track_prep handles exceptions from KaraokePrep."""
@@ -192,11 +192,11 @@ async def test_process_track_prep_failure(mock_getcwd, mock_chdir, mock_kprep, m
mock_chdir.assert_called_once_with("/fake/original/dir") # Should still change back
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.bulk_cli.os.path.exists", return_value=True) # Assume track dir exists
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.bulk_cli.os.path.exists", return_value=True) # Assume track dir exists
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("builtins.open", new_callable=mock_open, read_data=SAMPLE_STYLE_JSON) # For reading style JSON if CDG enabled
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_render_success(
@@ -253,11 +253,11 @@ async def test_process_track_render_success(
mock_chdir.assert_called_with("/fake/original/dir")
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.bulk_cli.os.path.exists", return_value=True)
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.bulk_cli.os.path.exists", return_value=True)
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("builtins.open", new_callable=mock_open, read_data=SAMPLE_STYLE_JSON)
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_render_finalise_failure(
@@ -438,11 +438,11 @@ def test_parse_and_validate_args_csv_not_found(mock_logger, mock_run, mock_isfil
mock_isfile.assert_called_once_with("/abs/nonexistent.csv")
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.bulk_cli.os.path.exists", return_value=True) # Track dir exists
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.bulk_cli.os.path.exists", return_value=True) # Track dir exists
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("builtins.open", side_effect=FileNotFoundError("Styles not found")) # Simulate style file not found
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_render_style_json_not_found_cdg(
@@ -466,11 +466,11 @@ async def test_process_track_render_style_json_not_found_cdg(
mock_kfinalise.assert_not_called()
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.bulk_cli.os.path.exists", return_value=True) # Track dir exists
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.bulk_cli.os.path.exists", return_value=True) # Track dir exists
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("builtins.open", new_callable=mock_open, read_data="invalid json") # Simulate invalid JSON
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_render_style_json_invalid_cdg(
@@ -494,11 +494,11 @@ async def test_process_track_render_style_json_invalid_cdg(
mock_kfinalise.assert_not_called()
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.bulk_cli.os.path.exists", return_value=False) # Simulate track dir NOT found
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.bulk_cli.os.path.exists", return_value=False) # Simulate track dir NOT found
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_render_track_dir_not_found(
mock_getcwd, mock_chdir, mock_exists, mock_kfinalise, mock_kprep,
@@ -527,11 +527,11 @@ async def test_process_track_render_track_dir_not_found(
# Add mocks for the new helper functions and process_csv_rows
@patch("karaoke_prep.utils.bulk_cli.process_csv_rows", new_callable=AsyncMock)
@patch("karaoke_prep.utils.bulk_cli._read_csv_file")
@patch("karaoke_prep.utils.bulk_cli._parse_and_validate_args")
@patch("karaoke_prep.utils.bulk_cli.setup_logging") # Mock logging setup
@patch("karaoke_prep.utils.bulk_cli.logger") # Mock the module-level logger directly
@patch("karaoke_gen.utils.bulk_cli.process_csv_rows", new_callable=AsyncMock)
@patch("karaoke_gen.utils.bulk_cli._read_csv_file")
@patch("karaoke_gen.utils.bulk_cli._parse_and_validate_args")
@patch("karaoke_gen.utils.bulk_cli.setup_logging") # Mock logging setup
@patch("karaoke_gen.utils.bulk_cli.logger") # Mock the module-level logger directly
@pytest.mark.asyncio # Explicitly mark as async test
async def test_async_main_dry_run(
mock_bulk_cli_logger, mock_setup_logging, mock_parse_args, mock_read_csv, mock_process_rows, # Added mock_bulk_cli_logger back
@@ -597,11 +597,11 @@ async def test_async_main_dry_run(
# This test focuses on async_main passing the flag correctly.
@patch("karaoke_prep.utils.bulk_cli.KaraokePrep")
@patch("karaoke_prep.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.bulk_cli.os.path.exists", return_value=True) # Assume track dir exists
@patch("karaoke_prep.utils.bulk_cli.os.chdir")
@patch("karaoke_prep.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("karaoke_gen.utils.bulk_cli.KaraokePrep")
@patch("karaoke_gen.utils.bulk_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.bulk_cli.os.path.exists", return_value=True) # Assume track dir exists
@patch("karaoke_gen.utils.bulk_cli.os.chdir")
@patch("karaoke_gen.utils.bulk_cli.os.getcwd", return_value="/fake/original/dir")
@patch("builtins.open", new_callable=mock_open, read_data=SAMPLE_STYLE_JSON) # For reading style JSON
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_track_render_cdg_enabled(
@@ -674,9 +674,9 @@ def test_setup_logging(mock_logger, mock_formatter, mock_handler):
@pytest.mark.asyncio
@patch("karaoke_prep.utils.bulk_cli.update_csv_status")
@patch("karaoke_prep.utils.bulk_cli.process_track_render", new_callable=AsyncMock)
@patch("karaoke_prep.utils.bulk_cli.process_track_prep", new_callable=AsyncMock)
@patch("karaoke_gen.utils.bulk_cli.update_csv_status")
@patch("karaoke_gen.utils.bulk_cli.process_track_render", new_callable=AsyncMock)
@patch("karaoke_gen.utils.bulk_cli.process_track_prep", new_callable=AsyncMock)
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_csv_rows(mock_process_prep, mock_process_render, mock_update_csv, mock_args, mock_logger, mock_log_formatter):
"""Test the process_csv_rows function processes CSV rows correctly."""
@@ -724,9 +724,9 @@ async def test_process_csv_rows(mock_process_prep, mock_process_render, mock_upd
@pytest.mark.asyncio
@patch("karaoke_prep.utils.bulk_cli.update_csv_status")
@patch("karaoke_prep.utils.bulk_cli.process_track_render", new_callable=AsyncMock)
@patch("karaoke_prep.utils.bulk_cli.process_track_prep", new_callable=AsyncMock)
@patch("karaoke_gen.utils.bulk_cli.update_csv_status")
@patch("karaoke_gen.utils.bulk_cli.process_track_render", new_callable=AsyncMock)
@patch("karaoke_gen.utils.bulk_cli.process_track_prep", new_callable=AsyncMock)
@pytest.mark.asyncio # Explicitly mark as async test
async def test_process_csv_rows_dry_run(mock_process_prep, mock_process_render, mock_update_csv, mock_args, mock_logger, mock_log_formatter):
"""Test the process_csv_rows function in dry run mode."""
+34 -34
View File
@@ -3,12 +3,12 @@ import pytest
import glob
import shutil
from unittest.mock import MagicMock, patch, mock_open, call, DEFAULT
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
import yt_dlp # Keep import for patching target
from karaoke_prep.utils import sanitize_filename # Import utility
from karaoke_gen.utils import sanitize_filename # Import utility
class TestFileOperations:
def test_copy_input_media(self, basic_karaoke_prep, temp_dir):
def test_copy_input_media(self, basic_karaoke_gen, temp_dir):
"""Test copying input media to a new location."""
# Setup
source_file = os.path.join(temp_dir, "source.mp4")
@@ -19,7 +19,7 @@ class TestFileOperations:
# Test with mocked shutil.copy2
with patch('shutil.copy2') as mock_copy:
result = basic_karaoke_prep.file_handler.copy_input_media(source_file, output_filename)
result = basic_karaoke_gen.file_handler.copy_input_media(source_file, output_filename)
# Verify the correct file path was returned
assert result == output_filename + ".mp4"
@@ -27,7 +27,7 @@ class TestFileOperations:
# Verify shutil.copy2 was called with correct arguments
mock_copy.assert_called_once_with(source_file, output_filename + ".mp4")
def test_copy_input_media_same_file(self, basic_karaoke_prep, temp_dir):
def test_copy_input_media_same_file(self, basic_karaoke_gen, temp_dir):
"""Test copying input media when source and destination are the same."""
# Setup
file_path = os.path.join(temp_dir, "file.mp4")
@@ -36,12 +36,12 @@ class TestFileOperations:
# Test with mocked os.path.abspath to simulate same file
with patch('os.path.abspath', side_effect=lambda x: x):
result = basic_karaoke_prep.file_handler.copy_input_media(file_path, file_path[:-4])
result = basic_karaoke_gen.file_handler.copy_input_media(file_path, file_path[:-4])
# Verify the correct file path was returned
assert result == file_path
def test_download_video(self, basic_karaoke_prep, temp_dir):
def test_download_video(self, basic_karaoke_gen, temp_dir):
"""Test downloading a video from a URL."""
url = "https://example.com/video"
output_filename = os.path.join(temp_dir, "output")
@@ -58,7 +58,7 @@ class TestFileOperations:
mock_glob_result = [downloaded_file]
# Patch the 'ydl' class used in file_handler.py and glob.glob
with patch('karaoke_prep.file_handler.ydl') as mock_ydl_context, \
with patch('karaoke_gen.file_handler.ydl') as mock_ydl_context, \
patch('glob.glob', return_value=mock_glob_result):
# Configure the context manager to return our mock instance
@@ -70,7 +70,7 @@ class TestFileOperations:
f.write("test video content")
# Call the method
result = basic_karaoke_prep.file_handler.download_video(url, output_filename)
result = basic_karaoke_gen.file_handler.download_video(url, output_filename)
# Verify the correct file path was returned
assert result == downloaded_file
@@ -90,7 +90,7 @@ class TestFileOperations:
# Verify glob was called
glob.glob.assert_called_once_with(f"{output_filename}.*")
def test_download_video_no_files_found(self, basic_karaoke_prep):
def test_download_video_no_files_found(self, basic_karaoke_gen):
"""Test downloading a video when no files are found after download."""
url = "https://example.com/video"
output_filename = "output"
@@ -103,14 +103,14 @@ class TestFileOperations:
mock_ydl_instance.download = MagicMock(return_value=None)
# Mock glob.glob to return empty list (no files found)
with patch('karaoke_prep.file_handler.ydl') as mock_ydl_context, \
with patch('karaoke_gen.file_handler.ydl') as mock_ydl_context, \
patch('glob.glob', return_value=[]):
# Configure the context manager to return our mock instance
mock_ydl_context.return_value.__enter__.return_value = mock_ydl_instance
# Call the method
result = basic_karaoke_prep.file_handler.download_video(url, output_filename)
result = basic_karaoke_gen.file_handler.download_video(url, output_filename)
# Verify None was returned
assert result is None
@@ -124,23 +124,23 @@ class TestFileOperations:
# Verify glob was called
glob.glob.assert_called_once_with(f"{output_filename}.*")
def test_extract_still_image_from_video(self, basic_karaoke_prep):
def test_extract_still_image_from_video(self, basic_karaoke_gen):
"""Test extracting a still image from a video."""
input_filename = "input.mp4"
output_filename = "output"
# Patch os.system directly within this test
with patch('os.system') as mock_os_system:
result = basic_karaoke_prep.file_handler.extract_still_image_from_video(input_filename, output_filename)
result = basic_karaoke_gen.file_handler.extract_still_image_from_video(input_filename, output_filename)
# Verify the correct file path was returned
assert result == output_filename + ".png"
# Verify os.system was called with correct arguments
expected_command = f'{basic_karaoke_prep.file_handler.ffmpeg_base_command} -i "{input_filename}" -ss 00:00:30 -vframes 1 "{output_filename}.png"'
expected_command = f'{basic_karaoke_gen.file_handler.ffmpeg_base_command} -i "{input_filename}" -ss 00:00:30 -vframes 1 "{output_filename}.png"'
mock_os_system.assert_called_once_with(expected_command)
def test_convert_to_wav_success(self, basic_karaoke_prep, temp_dir):
def test_convert_to_wav_success(self, basic_karaoke_gen, temp_dir):
"""Test converting input audio to WAV format successfully."""
# Create a test input file
input_filename = os.path.join(temp_dir, "input.mp3")
@@ -159,7 +159,7 @@ class TestFileOperations:
# Patch os.system directly
with patch('os.system') as mock_os_system:
result = basic_karaoke_prep.file_handler.convert_to_wav(input_filename, output_filename)
result = basic_karaoke_gen.file_handler.convert_to_wav(input_filename, output_filename)
# Verify the correct file path was returned
assert result == output_filename + ".wav"
@@ -167,7 +167,7 @@ class TestFileOperations:
# Verify os.system was called
mock_os_system.assert_called_once()
def test_convert_to_wav_file_not_found(self, basic_karaoke_prep):
def test_convert_to_wav_file_not_found(self, basic_karaoke_gen):
"""Test converting input audio when the file is not found."""
input_filename = "nonexistent.mp3"
output_filename = "output"
@@ -175,9 +175,9 @@ class TestFileOperations:
# Mock os.path.isfile to return False
with patch('os.path.isfile', return_value=False):
with pytest.raises(Exception, match=f"Input audio file not found: {input_filename}"):
basic_karaoke_prep.file_handler.convert_to_wav(input_filename, output_filename)
basic_karaoke_gen.file_handler.convert_to_wav(input_filename, output_filename)
def test_convert_to_wav_empty_file(self, basic_karaoke_prep):
def test_convert_to_wav_empty_file(self, basic_karaoke_gen):
"""Test converting input audio when the file is empty."""
input_filename = "empty.mp3"
output_filename = "output"
@@ -186,9 +186,9 @@ class TestFileOperations:
with patch('os.path.isfile', return_value=True), \
patch('os.path.getsize', return_value=0):
with pytest.raises(Exception, match=f"Input audio file is empty: {input_filename}"):
basic_karaoke_prep.file_handler.convert_to_wav(input_filename, output_filename)
basic_karaoke_gen.file_handler.convert_to_wav(input_filename, output_filename)
def test_convert_to_wav_no_audio_stream(self, basic_karaoke_prep):
def test_convert_to_wav_no_audio_stream(self, basic_karaoke_gen):
"""Test converting input audio when no audio stream is found."""
input_filename = "no_audio.mp4"
output_filename = "output"
@@ -202,9 +202,9 @@ class TestFileOperations:
mock_popen.return_value.read.return_value = "codec_type=video"
with pytest.raises(Exception, match=f"No valid audio stream found in file: {input_filename}"):
basic_karaoke_prep.file_handler.convert_to_wav(input_filename, output_filename)
basic_karaoke_gen.file_handler.convert_to_wav(input_filename, output_filename)
def test_sanitize_filename(self, basic_karaoke_prep):
def test_sanitize_filename(self, basic_karaoke_gen):
"""Test sanitizing filenames."""
# Test with various problematic characters
assert sanitize_filename('file/with\\chars:*?"<>|') == 'file_with_chars_'
@@ -215,34 +215,34 @@ class TestFileOperations:
assert sanitize_filename("valid_filename_123") == "valid_filename_123"
assert sanitize_filename("file_with__multiple___underscores") == "file_with_multiple_underscores"
def test_setup_output_paths(self, basic_karaoke_prep, temp_dir):
def test_setup_output_paths(self, basic_karaoke_gen, temp_dir):
"""Test setting up output paths."""
# Test with both artist and title
with patch('os.makedirs') as mock_makedirs:
basic_karaoke_prep.file_handler.output_dir = temp_dir
track_output_dir, artist_title = basic_karaoke_prep.file_handler.setup_output_paths(temp_dir, "Test Artist", "Test Title")
basic_karaoke_gen.file_handler.output_dir = temp_dir
track_output_dir, artist_title = basic_karaoke_gen.file_handler.setup_output_paths(temp_dir, "Test Artist", "Test Title")
assert artist_title == "Test Artist - Test Title"
assert track_output_dir == temp_dir
# Test with create_track_subfolders=True
basic_karaoke_prep.file_handler.create_track_subfolders = True
track_output_dir, artist_title = basic_karaoke_prep.file_handler.setup_output_paths(temp_dir, "Test Artist", "Test Title")
basic_karaoke_gen.file_handler.create_track_subfolders = True
track_output_dir, artist_title = basic_karaoke_gen.file_handler.setup_output_paths(temp_dir, "Test Artist", "Test Title")
expected_dir = os.path.join(temp_dir, "Test Artist - Test Title")
assert track_output_dir == expected_dir
mock_makedirs.assert_called_with(expected_dir)
def test_setup_output_paths_title_only(self, basic_karaoke_prep, temp_dir):
def test_setup_output_paths_title_only(self, basic_karaoke_gen, temp_dir):
"""Test setting up output paths with only title."""
with patch('os.makedirs'):
basic_karaoke_prep.file_handler.output_dir = temp_dir
track_output_dir, artist_title = basic_karaoke_prep.file_handler.setup_output_paths(temp_dir, None, "Test Title")
basic_karaoke_gen.file_handler.output_dir = temp_dir
track_output_dir, artist_title = basic_karaoke_gen.file_handler.setup_output_paths(temp_dir, None, "Test Title")
assert artist_title == "Test Title"
assert track_output_dir == temp_dir
def test_setup_output_paths_no_inputs(self, basic_karaoke_prep):
def test_setup_output_paths_no_inputs(self, basic_karaoke_gen):
"""Test setting up output paths with no inputs."""
with pytest.raises(ValueError, match="Error: At least title or artist must be provided"):
basic_karaoke_prep.file_handler.setup_output_paths(basic_karaoke_prep.output_dir, None, None)
basic_karaoke_gen.file_handler.setup_output_paths(basic_karaoke_gen.output_dir, None, None)
+98 -98
View File
@@ -7,7 +7,7 @@ import sys
from unittest.mock import patch, MagicMock, AsyncMock, mock_open, call
# Import the module/functions to test
from karaoke_prep.utils import gen_cli
from karaoke_gen.utils import gen_cli
# Mark all tests in this module as asyncio
pytestmark = pytest.mark.asyncio
@@ -112,20 +112,20 @@ def mock_logger():
@pytest.fixture(autouse=True)
def mock_pyperclip():
"""Automatically mock pyperclip."""
with patch("karaoke_prep.utils.gen_cli.pyperclip", MagicMock()) as mock_clip:
with patch("karaoke_gen.utils.gen_cli.pyperclip", MagicMock()) as mock_clip:
yield mock_clip
@pytest.fixture(autouse=True)
def mock_sleep():
"""Automatically mock time.sleep."""
with patch("karaoke_prep.utils.gen_cli.time.sleep", MagicMock()) as mock_sl:
with patch("karaoke_gen.utils.gen_cli.time.sleep", MagicMock()) as mock_sl:
yield mock_sl
# --- Test Argument Parsing Logic ---
@patch("karaoke_prep.utils.gen_cli.is_url", return_value=True)
@patch("karaoke_prep.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.is_url", return_value=True)
@patch("karaoke_gen.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
async def test_arg_parsing_url_only(mock_kprep_class, mock_isfile, mock_isurl, mock_base_args, mock_logger, caplog):
"""Test URL-only argument parsing."""
mock_base_args.args = ["https://example.com/song.mp3"]
@@ -133,7 +133,7 @@ async def test_arg_parsing_url_only(mock_kprep_class, mock_isfile, mock_isurl, m
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -144,9 +144,9 @@ async def test_arg_parsing_url_only(mock_kprep_class, mock_isfile, mock_isurl, m
# Verify warning in log
assert "Input media provided without Artist and Title" in caplog.text
@patch("karaoke_prep.utils.gen_cli.is_url", return_value=True)
@patch("karaoke_prep.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.is_url", return_value=True)
@patch("karaoke_gen.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
async def test_arg_parsing_url_artist_title(mock_kprep_class, mock_isfile, mock_isurl, mock_base_args, mock_logger):
"""Test parsing: URL, Artist, Title."""
mock_base_args.args = ["http://example.com/video.mp4", "URL Artist", "URL Title"]
@@ -154,7 +154,7 @@ async def test_arg_parsing_url_artist_title(mock_kprep_class, mock_isfile, mock_
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -165,9 +165,9 @@ async def test_arg_parsing_url_artist_title(mock_kprep_class, mock_isfile, mock_
mock_kprep_instance.process.assert_awaited_once()
assert call_kwargs["title"] == "URL Title"
@patch("karaoke_prep.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_prep.utils.gen_cli.is_file", return_value=True)
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_gen.utils.gen_cli.is_file", return_value=True)
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
async def test_arg_parsing_file_artist_title(mock_kprep_class, mock_isfile, mock_isurl, mock_base_args, mock_logger):
"""Test parsing: Local File, Artist, Title."""
mock_base_args.args = ["/path/to/song.mp3", "File Artist", "File Title"]
@@ -175,7 +175,7 @@ async def test_arg_parsing_file_artist_title(mock_kprep_class, mock_isfile, mock
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -186,10 +186,10 @@ async def test_arg_parsing_file_artist_title(mock_kprep_class, mock_isfile, mock
mock_kprep_instance.process.assert_awaited_once()
assert call_kwargs["title"] == "File Title"
@patch("karaoke_prep.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_prep.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_prep.utils.gen_cli.os.path.isdir", return_value=False)
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_gen.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_gen.utils.gen_cli.os.path.isdir", return_value=False)
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
async def test_arg_parsing_artist_title_only(mock_kprep_class, mock_isdir, mock_isfile, mock_isurl, mock_base_args, mock_logger, caplog):
"""Test Artist and Title only argument parsing."""
mock_base_args.args = ["Test Artist", "Test Title"]
@@ -197,7 +197,7 @@ async def test_arg_parsing_artist_title_only(mock_kprep_class, mock_isdir, mock_
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -210,10 +210,10 @@ async def test_arg_parsing_artist_title_only(mock_kprep_class, mock_isdir, mock_
# Verify warning about YouTube search is shown
assert "No input media provided, the top YouTube search result for" in caplog.text
@patch("karaoke_prep.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_prep.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_prep.utils.gen_cli.os.path.isdir", return_value=True)
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_gen.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_gen.utils.gen_cli.os.path.isdir", return_value=True)
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
async def test_arg_parsing_folder_artist_pattern(mock_kprep_class, mock_isdir, mock_isfile, mock_isurl, mock_base_args, mock_logger):
"""Test parsing: Folder, Artist, Pattern."""
mock_base_args.args = ["/path/to/folder", "Folder Artist"]
@@ -222,7 +222,7 @@ async def test_arg_parsing_folder_artist_pattern(mock_kprep_class, mock_isdir, m
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -233,16 +233,16 @@ async def test_arg_parsing_folder_artist_pattern(mock_kprep_class, mock_isdir, m
mock_kprep_instance.process.assert_awaited_once()
assert call_kwargs["filename_pattern"] == r"(?P<index>\d+) - (?P<title>.+)\.mp3"
@patch("karaoke_prep.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_prep.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_prep.utils.gen_cli.os.path.isdir", return_value=True)
@patch("karaoke_prep.utils.gen_cli.sys.exit")
@patch("karaoke_gen.utils.gen_cli.is_url", return_value=False)
@patch("karaoke_gen.utils.gen_cli.is_file", return_value=False)
@patch("karaoke_gen.utils.gen_cli.os.path.isdir", return_value=True)
@patch("karaoke_gen.utils.gen_cli.sys.exit")
async def test_arg_parsing_folder_missing_pattern(mock_exit, mock_isdir, mock_isfile, mock_isurl, mock_base_args, mock_logger):
"""Test parsing exits if folder provided without filename_pattern."""
mock_base_args.args = ["/path/to/folder", "Folder Artist"]
mock_base_args.filename_pattern = None # Missing pattern
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -252,8 +252,8 @@ async def test_arg_parsing_folder_missing_pattern(mock_exit, mock_isdir, mock_is
# --- Test Workflow Modes ---
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise") # Should not be called
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise") # Should not be called
async def test_workflow_prep_only(mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger):
"""Test --prep-only workflow."""
mock_base_args.args = ["Artist", "Title"]
@@ -262,8 +262,8 @@ async def test_workflow_prep_only(mock_kfinalise, mock_kprep_class, mock_base_ar
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK]) # Simulate prep output
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -274,8 +274,8 @@ async def test_workflow_prep_only(mock_kfinalise, mock_kprep_class, mock_base_ar
assert mock_logger.info.called
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Should not be called
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Should not be called
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("builtins.open", new_callable=mock_open) # Mock open for style JSON if CDG enabled
async def test_workflow_finalise_only(mock_open, mock_kfinalise, mock_kprep, mock_base_args, mock_logger):
"""Test --finalise-only workflow."""
@@ -283,8 +283,8 @@ async def test_workflow_finalise_only(mock_open, mock_kfinalise, mock_kprep, moc
mock_kfinalise_instance = mock_kfinalise.return_value
mock_kfinalise_instance.process = MagicMock(return_value=MOCK_FINAL_TRACK)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -295,10 +295,10 @@ async def test_workflow_finalise_only(mock_open, mock_kfinalise, mock_kprep, moc
assert mock_logger.info.called
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.gen_cli.os.path.basename", return_value="Edit Artist - Edit Title")
@patch("karaoke_prep.utils.gen_cli.os.getcwd", return_value="/fake/path/Edit Artist - Edit Title")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.os.path.basename", return_value="Edit Artist - Edit Title")
@patch("karaoke_gen.utils.gen_cli.os.getcwd", return_value="/fake/path/Edit Artist - Edit Title")
@patch("builtins.open", new_callable=mock_open) # Mock open for style JSON if CDG enabled
async def test_workflow_edit_lyrics(mock_open, mock_getcwd, mock_basename, mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger):
"""Test --edit-lyrics workflow."""
@@ -317,7 +317,7 @@ async def test_workflow_edit_lyrics(mock_open, mock_getcwd, mock_basename, mock_
mock_kfinalise_instance = mock_kfinalise.return_value
mock_kfinalise_instance.process = MagicMock(return_value=MOCK_FINAL_TRACK)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -345,15 +345,15 @@ async def test_workflow_edit_lyrics(mock_open, mock_getcwd, mock_basename, mock_
mock_kfinalise_instance.process.assert_called_once_with(replace_existing=True) # Should replace
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
async def test_workflow_test_email_template(mock_kfinalise, mock_base_args, mock_logger):
"""Test --test_email_template workflow."""
mock_base_args.test_email_template = True
mock_base_args.email_template_file = "template.txt"
mock_kfinalise_instance = mock_kfinalise.return_value
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -364,8 +364,8 @@ async def test_workflow_test_email_template(mock_kfinalise, mock_base_args, mock
assert mock_logger.info.called
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
async def test_workflow_lyrics_only(mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger):
"""Test --lyrics-only workflow sets environment variables and skips."""
mock_base_args.args = ["Artist", "Title"]
@@ -376,13 +376,13 @@ async def test_workflow_lyrics_only(mock_kfinalise, mock_kprep_class, mock_base_
mock_kfinalise_instance = mock_kfinalise.return_value
mock_kfinalise_instance.process = MagicMock(return_value=MOCK_FINAL_TRACK)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger), \
patch.dict("karaoke_prep.utils.gen_cli.os.environ", {}, clear=True), \
patch("karaoke_prep.utils.gen_cli.os.environ.get") as mock_environ_get:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger), \
patch.dict("karaoke_gen.utils.gen_cli.os.environ", {}, clear=True), \
patch("karaoke_gen.utils.gen_cli.os.environ.get") as mock_environ_get:
mock_parser.return_value.parse_args.return_value = mock_base_args
# Set up the mock to return "1" for our environment variables
mock_environ_get.side_effect = lambda key, default=None: "1" if key in ["KARAOKE_PREP_SKIP_AUDIO_SEPARATION", "KARAOKE_PREP_SKIP_TITLE_END_SCREENS"] else default
mock_environ_get.side_effect = lambda key, default=None: "1" if key in ["KARAOKE_GEN_SKIP_AUDIO_SEPARATION", "KARAOKE_GEN_SKIP_TITLE_END_SCREENS"] else default
await gen_cli.async_main()
# Since we can't reliably test the os.environ, check that skip_separation was set
@@ -395,11 +395,11 @@ async def test_workflow_lyrics_only(mock_kfinalise, mock_kprep_class, mock_base_
# --- Test Finalise CDG Style Loading ---
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("builtins.open", new_callable=mock_open, read_data=SAMPLE_STYLE_JSON)
@patch("karaoke_prep.utils.gen_cli.os.chdir") # Mock chdir
@patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True) # Assume track dir exists
@patch("karaoke_gen.utils.gen_cli.os.chdir") # Mock chdir
@patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True) # Assume track dir exists
async def test_finalise_cdg_style_loading(mock_exists, mock_chdir, mock_open, mock_kfinalise, mock_kprep_class, mock_base_args):
"""Test that CDG styles are loaded correctly when --enable_cdg is used."""
mock_base_args.args = ["Artist", "Title"]
@@ -412,7 +412,7 @@ async def test_finalise_cdg_style_loading(mock_exists, mock_chdir, mock_open, mo
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
mock_kfinalise.return_value.process = MagicMock(return_value=MOCK_FINAL_TRACK)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -427,12 +427,12 @@ async def test_finalise_cdg_style_loading(mock_exists, mock_chdir, mock_open, mo
assert finalise_call_kwargs["cdg_styles"] == expected_cdg_styles
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("builtins.open", side_effect=FileNotFoundError)
@patch("karaoke_prep.utils.gen_cli.os.chdir")
@patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_prep.utils.gen_cli.sys.exit")
@patch("karaoke_gen.utils.gen_cli.os.chdir")
@patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_gen.utils.gen_cli.sys.exit")
async def test_finalise_cdg_style_file_not_found(mock_exit, mock_exists, mock_chdir, mock_open, mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger):
"""Test exit if CDG enabled but style file not found."""
mock_base_args.args = ["Artist", "Title"]
@@ -443,8 +443,8 @@ async def test_finalise_cdg_style_file_not_found(mock_exit, mock_exists, mock_ch
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -455,12 +455,12 @@ async def test_finalise_cdg_style_file_not_found(mock_exit, mock_exists, mock_ch
mock_kfinalise.assert_not_called()
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("builtins.open", new_callable=mock_open, read_data="invalid json") # Invalid JSON
@patch("karaoke_prep.utils.gen_cli.os.chdir")
@patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_prep.utils.gen_cli.sys.exit")
@patch("karaoke_gen.utils.gen_cli.os.chdir")
@patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_gen.utils.gen_cli.sys.exit")
async def test_finalise_cdg_style_invalid_json(mock_exit, mock_exists, mock_chdir, mock_open, mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger):
"""Test exit if CDG enabled but style file has invalid JSON."""
mock_base_args.args = ["Artist", "Title"]
@@ -471,8 +471,8 @@ async def test_finalise_cdg_style_invalid_json(mock_exit, mock_exists, mock_chdi
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.logging.getLogger", return_value=mock_logger):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.logging.getLogger", return_value=mock_logger):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -484,8 +484,8 @@ async def test_finalise_cdg_style_invalid_json(mock_exit, mock_exists, mock_chdi
mock_kfinalise.assert_not_called()
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
async def test_error_handling_kprep_failure(mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger, caplog):
"""Test error handling if KaraokePrep.process fails."""
mock_base_args.args = ["Artist", "Title"]
@@ -493,7 +493,7 @@ async def test_error_handling_kprep_failure(mock_kfinalise, mock_kprep_class, mo
mock_kprep_class.return_value = mock_kprep_instance
mock_kprep_instance.process = AsyncMock(side_effect=Exception("KPrep Failed!"))
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
# Expect the exception to propagate
with pytest.raises(Exception, match="KPrep Failed!"):
@@ -504,10 +504,10 @@ async def test_error_handling_kprep_failure(mock_kfinalise, mock_kprep_class, mo
mock_kfinalise.assert_not_called() # Should not reach finalise
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.gen_cli.os.chdir")
@patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.os.chdir")
@patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True)
async def test_error_handling_kfinalise_failure(mock_exists, mock_chdir, mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger, caplog):
"""Test error handling if KaraokeFinalise.process fails."""
mock_base_args.args = ["Artist", "Title"]
@@ -517,7 +517,7 @@ async def test_error_handling_kfinalise_failure(mock_exists, mock_chdir, mock_kf
mock_kfinalise_instance = mock_kfinalise.return_value
mock_kfinalise_instance.process.side_effect = Exception("KFinalise Failed!")
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
# Expect the exception to propagate
with pytest.raises(Exception, match="KFinalise Failed!"):
@@ -533,8 +533,8 @@ async def test_error_handling_kfinalise_failure(mock_exists, mock_chdir, mock_kf
assert "An error occurred during finalisation, see stack trace below: KFinalise Failed!" in caplog.text
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
async def test_argument_passthrough(mock_kfinalise, mock_kprep_class, mock_base_args):
"""Test that various arguments are passed correctly to KaraokePrep/Finalise."""
mock_base_args.args = ["Artist", "Title"]
@@ -557,9 +557,9 @@ async def test_argument_passthrough(mock_kfinalise, mock_kprep_class, mock_base_
mock_kprep_instance.process = AsyncMock(return_value=[MOCK_PREP_TRACK])
mock_kfinalise.return_value.process = MagicMock(return_value=MOCK_FINAL_TRACK)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_prep.utils.gen_cli.os.chdir"), \
patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True):
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser, \
patch("karaoke_gen.utils.gen_cli.os.chdir"), \
patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True):
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -586,11 +586,11 @@ async def test_argument_passthrough(mock_kfinalise, mock_kprep_class, mock_base_
assert finalise_kwargs["non_interactive"] is True
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.gen_cli.os.chdir")
@patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_prep.utils.gen_cli.pyperclip.copy")
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.os.chdir")
@patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_gen.utils.gen_cli.pyperclip.copy")
async def test_clipboard_copy_success(mock_copy, mock_exists, mock_chdir, mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger, caplog):
"""Test logging when clipboard copy succeeds."""
mock_base_args.args = ["Artist", "Title"]
@@ -606,7 +606,7 @@ async def test_clipboard_copy_success(mock_copy, mock_exists, mock_chdir, mock_k
mock_final_track_with_urls["brand_code_dir_sharing_link"] = "http://share.link/fake"
mock_kfinalise.return_value.process = MagicMock(return_value=mock_final_track_with_urls)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
@@ -621,11 +621,11 @@ async def test_clipboard_copy_success(mock_copy, mock_exists, mock_chdir, mock_k
], any_order=True)
@patch("karaoke_prep.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_prep.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_prep.utils.gen_cli.os.chdir")
@patch("karaoke_prep.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_prep.utils.gen_cli.pyperclip.copy", side_effect=Exception("Clipboard Error"))
@patch("karaoke_gen.utils.gen_cli.KaraokePrep") # Use default MagicMock for class
@patch("karaoke_gen.utils.gen_cli.KaraokeFinalise")
@patch("karaoke_gen.utils.gen_cli.os.chdir")
@patch("karaoke_gen.utils.gen_cli.os.path.exists", return_value=True)
@patch("karaoke_gen.utils.gen_cli.pyperclip.copy", side_effect=Exception("Clipboard Error"))
async def test_clipboard_copy_failure(mock_copy, mock_exists, mock_chdir, mock_kfinalise, mock_kprep_class, mock_base_args, mock_logger, caplog):
"""Test logging when clipboard copy fails."""
mock_base_args.args = ["Artist", "Title"]
@@ -641,7 +641,7 @@ async def test_clipboard_copy_failure(mock_copy, mock_exists, mock_chdir, mock_k
mock_final_track_with_urls["brand_code_dir_sharing_link"] = "http://share.link/fake"
mock_kfinalise.return_value.process = MagicMock(return_value=mock_final_track_with_urls)
with patch("karaoke_prep.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
with patch("karaoke_gen.utils.gen_cli.argparse.ArgumentParser") as mock_parser:
mock_parser.return_value.parse_args.return_value = mock_base_args
await gen_cli.async_main()
+25 -25
View File
@@ -3,27 +3,27 @@ import pytest
from unittest.mock import MagicMock, patch
import json
import logging
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
import tempfile
class TestInitialization:
def test_init_with_defaults(self, mock_logger):
"""Test initialization with default parameters."""
karaoke_prep = KaraokePrep(logger=mock_logger)
karaoke_gen = KaraokePrep(logger=mock_logger)
assert karaoke_prep.input_media is None
assert karaoke_prep.artist is None
assert karaoke_prep.title is None
assert karaoke_prep.dry_run is False
assert karaoke_prep.logger is mock_logger
assert karaoke_prep.output_dir == "."
assert karaoke_prep.lossless_output_format == "flac"
assert karaoke_prep.create_track_subfolders is False
assert karaoke_gen.input_media is None
assert karaoke_gen.artist is None
assert karaoke_gen.title is None
assert karaoke_gen.dry_run is False
assert karaoke_gen.logger is mock_logger
assert karaoke_gen.output_dir == "."
assert karaoke_gen.lossless_output_format == "flac"
assert karaoke_gen.create_track_subfolders is False
def test_init_with_custom_params(self, mock_logger):
"""Test initialization with custom parameters."""
with patch('os.makedirs'):
karaoke_prep = KaraokePrep(
karaoke_gen = KaraokePrep(
input_media="test_media.mp4",
artist="Test Artist",
title="Test Title",
@@ -34,21 +34,21 @@ class TestInitialization:
create_track_subfolders=True
)
assert karaoke_prep.input_media == "test_media.mp4"
assert karaoke_prep.artist == "Test Artist"
assert karaoke_prep.title == "Test Title"
assert karaoke_prep.dry_run is True
assert karaoke_prep.logger is mock_logger
assert karaoke_prep.output_dir == "test_output"
assert karaoke_prep.lossless_output_format == "wav"
assert karaoke_prep.create_track_subfolders is True
assert karaoke_gen.input_media == "test_media.mp4"
assert karaoke_gen.artist == "Test Artist"
assert karaoke_gen.title == "Test Title"
assert karaoke_gen.dry_run is True
assert karaoke_gen.logger is mock_logger
assert karaoke_gen.output_dir == "test_output"
assert karaoke_gen.lossless_output_format == "wav"
assert karaoke_gen.create_track_subfolders is True
def test_init_creates_output_dir(self, mock_logger, temp_dir):
"""Test that initialization creates the output directory if it doesn't exist."""
output_dir = os.path.join(temp_dir, "new_dir")
with patch('os.makedirs') as mock_makedirs:
karaoke_prep = KaraokePrep(
karaoke_gen = KaraokePrep(
logger=mock_logger,
output_dir=output_dir
)
@@ -97,15 +97,15 @@ class TestInitialization:
with open(style_params_path, "w") as f:
json.dump(style_params, f)
karaoke_prep = KaraokePrep(
karaoke_gen = KaraokePrep(
logger=mock_logger,
style_params_json=style_params_path
)
assert karaoke_prep.intro_video_duration == 10
assert karaoke_prep.end_video_duration == 8
assert karaoke_prep.title_format["background_color"] == "#FF0000"
assert karaoke_prep.end_format["background_color"] == "#0000FF"
assert karaoke_gen.intro_video_duration == 10
assert karaoke_gen.end_video_duration == 8
assert karaoke_gen.title_format["background_color"] == "#FF0000"
assert karaoke_gen.end_format["background_color"] == "#0000FF"
def test_init_with_invalid_style_params_file(self, mock_logger):
"""Test initialization with an invalid style params file path."""
@@ -4,7 +4,7 @@ import shlex
from unittest.mock import patch, MagicMock, call
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
from .test_file_input_validation import BASE_NAME, TITLE_MOV, END_MOV, WITH_VOCALS_MOV, INSTRUMENTAL_FLAC # Reuse constants
@@ -4,7 +4,7 @@ import json
from unittest.mock import patch, MagicMock, mock_open, call
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
BASE_NAME = "Artist - Title"
@@ -6,7 +6,7 @@ import time
from unittest.mock import patch, MagicMock, call, ANY
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
from .test_file_input_validation import BASE_NAME, ARTIST, TITLE # Reuse constants
from .test_ffmpeg_commands import OUTPUT_FILES as FFMPEG_OUTPUT_FILES # Reuse constants
@@ -6,7 +6,7 @@ from unittest.mock import patch, MagicMock, mock_open
# Adjust the import path based on your project structure
# Assuming tests are run from the project root
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
# Basic configuration for tests
MINIMAL_CONFIG = {
@@ -79,7 +79,7 @@ def test_init_custom_logger_setup():
finaliser = KaraokeFinalise(log_level=logging.INFO, **MINIMAL_CONFIG)
mock_get_logger.assert_called_once_with('karaoke_prep.karaoke_finalise.karaoke_finalise')
mock_get_logger.assert_called_once_with('karaoke_gen.karaoke_finalise.karaoke_finalise')
mock_logger_instance.setLevel.assert_called_once_with(logging.INFO)
mock_stream_handler.assert_called_once()
mock_formatter.assert_called_once_with("%(asctime)s - %(levelname)s - %(module)s - %(message)s")
@@ -7,7 +7,7 @@ from unittest.mock import patch, MagicMock, mock_open, call, ANY
import requests # For requests.exceptions.RequestException
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
from .test_file_input_validation import ARTIST, TITLE # Reuse constants
from .test_youtube_integration import mock_google_auth # Reuse Gmail auth mocks structure
@@ -112,7 +112,7 @@ def test_post_discord_notification_dry_run(mock_post_msg, finaliser_for_notify):
# Patch open for token write.
# Patch the from_client_secrets_file method to control the flow instance.
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.InstalledAppFlow.from_client_secrets_file')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.InstalledAppFlow.from_client_secrets_file')
@patch("builtins.open")
def test_authenticate_gmail_new_token(mock_open, mock_from_secrets, finaliser_for_notify, mock_google_auth, mock_gmail_service):
"""Test Gmail authentication flow when no token file exists."""
@@ -233,7 +233,7 @@ def test_authenticate_gmail_refresh_token(finaliser_for_notify, mock_google_auth
@patch('builtins.open', new_callable=mock_open, read_data="YT: {youtube_url}\nDB: {dropbox_url}")
@patch.object(KaraokeFinalise, 'authenticate_gmail')
# Patch MIMEText where it's used inside the karaoke_finalise module
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.MIMEText', return_value=MagicMock(spec=MIMEText))
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.MIMEText', return_value=MagicMock(spec=MIMEText))
@patch('base64.urlsafe_b64encode')
def test_draft_completion_email_success(mock_b64encode, mock_mime_text_cls, mock_auth_gmail, mock_open_template, finaliser_for_notify, mock_gmail_service):
"""Test successful email draft creation."""
@@ -3,7 +3,7 @@ import os
from unittest.mock import patch, MagicMock, call, ANY
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
from .test_file_input_validation import BASE_NAME, ARTIST, TITLE, WITH_VOCALS_MOV, INSTRUMENTAL_FLAC # Reuse constants
from .test_ffmpeg_commands import OUTPUT_FILES as FFMPEG_OUTPUT_FILES # Reuse constants
@@ -2,7 +2,7 @@ import pytest
from unittest.mock import patch, MagicMock
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
PROMPT_MSG = "Do you want to proceed?"
@@ -4,7 +4,7 @@ import pickle
from unittest.mock import patch, MagicMock, mock_open, call, ANY
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
from .test_file_input_validation import BASE_NAME, ARTIST, TITLE, TITLE_JPG # Reuse constants
from .test_ffmpeg_commands import OUTPUT_FILES as FFMPEG_OUTPUT_FILES # Reuse constants
@@ -51,7 +51,7 @@ def mock_youtube_service():
def mock_google_auth():
"""Fixture to mock Google auth dependencies."""
# Patch build, pickle, os.path, and Request. Flow is patched in specific tests.
with patch('karaoke_prep.karaoke_finalise.karaoke_finalise.build') as mock_build, \
with patch('karaoke_gen.karaoke_finalise.karaoke_finalise.build') as mock_build, \
patch('pickle.dump') as mock_pickle_dump, \
patch('pickle.load') as mock_pickle_load, \
patch('os.path.exists') as mock_path_exists, \
@@ -102,7 +102,7 @@ def test_truncate_to_nearest_word(basic_finaliser):
# Patch open for token write.
# Patch the from_client_secrets_file method to control the flow instance.
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.InstalledAppFlow.from_client_secrets_file')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.InstalledAppFlow.from_client_secrets_file')
@patch("builtins.open")
def test_authenticate_youtube_new_token(mock_open, mock_from_secrets, finaliser_for_yt, mock_google_auth, mock_youtube_service):
"""Test authentication flow when no token file exists."""
@@ -374,7 +374,7 @@ def test_delete_youtube_video_dry_run(mock_auth, finaliser_for_yt, mock_youtube_
@patch('builtins.open', new_callable=mock_open, read_data="Custom description from file")
# Patch the MediaFileUpload class where it's imported in the module under test
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch.object(KaraokeFinalise, 'authenticate_youtube')
@patch.object(KaraokeFinalise, 'check_if_video_title_exists_on_youtube_channel', return_value=False) # Assume not exists
@patch.object(KaraokeFinalise, 'truncate_to_nearest_word', side_effect=lambda t, l: t) # Passthrough truncate
@@ -425,7 +425,7 @@ def test_upload_youtube_success(mock_truncate, mock_check_exists, mock_auth, moc
assert finaliser_for_yt.youtube_url == f"https://www.youtube.com/watch?v=new_video_id"
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch.object(KaraokeFinalise, 'authenticate_youtube')
@patch.object(KaraokeFinalise, 'check_if_video_title_exists_on_youtube_channel', return_value=True) # Assume exists
@patch.object(KaraokeFinalise, 'delete_youtube_video')
@@ -445,7 +445,7 @@ def test_upload_youtube_exists_skip(mock_delete, mock_check_exists, mock_auth, m
@patch('builtins.open', new_callable=mock_open, read_data="Desc") # Mock open for description file
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch.object(KaraokeFinalise, 'authenticate_youtube')
@patch.object(KaraokeFinalise, 'check_if_video_title_exists_on_youtube_channel', return_value=True) # Assume exists
@patch.object(KaraokeFinalise, 'delete_youtube_video', return_value=True) # Delete succeeds
@@ -469,7 +469,7 @@ def test_upload_youtube_exists_replace_success(mock_delete, mock_check_exists, m
mock_open_desc.assert_called_once_with(YOUTUBE_DESC_FILE, "r") # Check desc file read
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.MediaFileUpload')
@patch.object(KaraokeFinalise, 'authenticate_youtube')
@patch.object(KaraokeFinalise, 'check_if_video_title_exists_on_youtube_channel', return_value=True) # Assume exists
@patch.object(KaraokeFinalise, 'delete_youtube_video', return_value=False) # Delete fails
@@ -5,7 +5,7 @@ import tomllib # Keep import for patching
from unittest.mock import patch, MagicMock, mock_open, call
# Adjust the import path
from karaoke_prep.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
from .test_initialization import mock_logger, basic_finaliser, MINIMAL_CONFIG # Reuse fixtures
from .test_file_input_validation import BASE_NAME, KARAOKE_LRC, INSTRUMENTAL_FLAC # Reuse constants
@@ -234,7 +234,7 @@ def test_create_cdg_zip_generation_fails_to_create_zip(mock_prompt, mock_cdg_gen
@patch('os.path.isfile')
@patch('zipfile.ZipFile')
# Patch the converter where it's imported in the target module
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.LyricsConverter')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.LyricsConverter')
@patch('builtins.open', new_callable=mock_open) # For the TXT write
@patch.object(KaraokeFinalise, 'prompt_user_bool', return_value=True) # Confirm overwrite
def test_create_txt_zip_generate_new(mock_prompt, mock_open_txt_write, mock_lyrics_converter_cls, mock_zipfile, mock_isfile, basic_finaliser):
@@ -281,7 +281,7 @@ def test_create_txt_zip_skip_overwrite(mock_prompt, mock_open_file, mock_lyrics_
@patch('os.path.isfile')
@patch('zipfile.ZipFile', side_effect=Exception("Zip creation failed")) # Simulate zip error
@patch('karaoke_prep.karaoke_finalise.karaoke_finalise.LyricsConverter')
@patch('karaoke_gen.karaoke_finalise.karaoke_finalise.LyricsConverter')
@patch('builtins.open', new_callable=mock_open) # For the TXT write
@patch.object(KaraokeFinalise, 'prompt_user_bool', return_value=True)
def test_create_txt_zip_creation_fails(mock_prompt, mock_open_txt_write, mock_lyrics_converter_cls, mock_zipfile, mock_isfile, basic_finaliser):
+33 -33
View File
@@ -2,76 +2,76 @@ import os
import pytest
from unittest.mock import MagicMock, patch, call, DEFAULT
import shutil
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_prep.utils import sanitize_filename
from karaoke_gen.karaoke_gen import KaraokePrep
from karaoke_gen.utils import sanitize_filename
class TestLyrics:
def test_find_best_split_point_with_comma(self, basic_karaoke_prep):
def test_find_best_split_point_with_comma(self, basic_karaoke_gen):
"""Test finding the best split point with a comma near the middle."""
line = "This is a test line, with a comma near the middle of the sentence"
split_point = basic_karaoke_prep.lyrics_processor.find_best_split_point(line)
split_point = basic_karaoke_gen.lyrics_processor.find_best_split_point(line)
# The split should be after the comma
assert line[:split_point].strip() == "This is a test line,"
assert line[split_point:].strip() == "with a comma near the middle of the sentence"
def test_find_best_split_point_with_and(self, basic_karaoke_prep):
def test_find_best_split_point_with_and(self, basic_karaoke_gen):
"""Test finding the best split point with 'and' near the middle."""
line = "This is a test line and this is the second part of the sentence"
split_point = basic_karaoke_prep.lyrics_processor.find_best_split_point(line)
split_point = basic_karaoke_gen.lyrics_processor.find_best_split_point(line)
# The split should be after 'and'
assert line[:split_point].strip() == "This is a test line and"
assert line[split_point:].strip() == "this is the second part of the sentence"
def test_find_best_split_point_at_middle_word(self, basic_karaoke_prep):
def test_find_best_split_point_at_middle_word(self, basic_karaoke_gen):
"""Test finding the best split point at the middle word."""
line = "This is a test line without any good split points"
split_point = basic_karaoke_prep.lyrics_processor.find_best_split_point(line)
split_point = basic_karaoke_gen.lyrics_processor.find_best_split_point(line)
# The split should be at the middle word
assert line[:split_point].strip() == "This is a test line"
assert line[split_point:].strip() == "without any good split points"
def test_find_best_split_point_forced_split(self, basic_karaoke_prep):
def test_find_best_split_point_forced_split(self, basic_karaoke_gen):
"""Test finding the best split point with forced split at max length."""
# Create a very long line without good split points
line = "Thisisaverylonglinewithoutanyspacesorpunctuationthatexceedsthemaximumlengthallowedforasingleline"
split_point = basic_karaoke_prep.lyrics_processor.find_best_split_point(line)
split_point = basic_karaoke_gen.lyrics_processor.find_best_split_point(line)
# The split should be at the maximum length (36)
assert split_point == 36
assert len(line[:split_point]) == 36
def test_process_line_short(self, basic_karaoke_prep):
def test_process_line_short(self, basic_karaoke_gen):
"""Test processing a line that's already short enough."""
line = "This is a short line"
processed = basic_karaoke_prep.lyrics_processor.process_line(line)
processed = basic_karaoke_gen.lyrics_processor.process_line(line)
assert processed == [line]
def test_process_line_with_parentheses(self, basic_karaoke_prep):
def test_process_line_with_parentheses(self, basic_karaoke_gen):
"""Test processing a line with parentheses."""
line = "This is a line with (some parenthetical text) that should be split"
processed = basic_karaoke_prep.lyrics_processor.process_line(line)
processed = basic_karaoke_gen.lyrics_processor.process_line(line)
assert processed[0] == "This is a line with"
assert processed[1] == "(some parenthetical text)"
assert processed[2] == "that should be split"
def test_process_line_with_parentheses_and_comma(self, basic_karaoke_prep):
def test_process_line_with_parentheses_and_comma(self, basic_karaoke_gen):
"""Test processing a line with parentheses followed by a comma."""
line = "This is a line with (some parenthetical text), that should be split"
processed = basic_karaoke_prep.lyrics_processor.process_line(line)
processed = basic_karaoke_gen.lyrics_processor.process_line(line)
assert processed[0] == "This is a line with"
assert processed[1] == "(some parenthetical text),"
assert processed[2] == "that should be split"
def test_process_line_long(self, basic_karaoke_prep):
def test_process_line_long(self, basic_karaoke_gen):
"""Test processing a long line that needs multiple splits."""
line = "This is a very long line that needs to be split into multiple lines because it exceeds the maximum length allowed for a single line"
processed = basic_karaoke_prep.lyrics_processor.process_line(line)
processed = basic_karaoke_gen.lyrics_processor.process_line(line)
# Should be split into multiple lines
assert len(processed) > 1
@@ -79,7 +79,7 @@ class TestLyrics:
for p in processed:
assert len(p) <= 36
def test_transcribe_lyrics_existing_files_parent_dir(self, basic_karaoke_prep, temp_dir):
def test_transcribe_lyrics_existing_files_parent_dir(self, basic_karaoke_gen, temp_dir):
"""Test transcribing lyrics when files already exist in parent directory."""
# Setup
track_output_dir = os.path.join(temp_dir, "track")
@@ -103,13 +103,13 @@ class TestLyrics:
# Test with mocked os.path.exists
with patch('os.path.exists', return_value=True):
# Call the method on the lyrics_processor
result = basic_karaoke_prep.lyrics_processor.transcribe_lyrics(None, artist, title, track_output_dir)
result = basic_karaoke_gen.lyrics_processor.transcribe_lyrics(None, artist, title, track_output_dir)
# Verify
assert result["lrc_filepath"] == parent_lrc_path
assert result["ass_filepath"] == parent_video_path
def test_transcribe_lyrics_existing_files_lyrics_dir(self, basic_karaoke_prep, temp_dir):
def test_transcribe_lyrics_existing_files_lyrics_dir(self, basic_karaoke_gen, temp_dir):
"""Test transcribing lyrics when files already exist in lyrics directory."""
# Setup
track_output_dir = os.path.join(temp_dir, "track")
@@ -138,7 +138,7 @@ class TestLyrics:
with patch('os.path.exists', side_effect=lambda path: path in [lyrics_video_path, lyrics_lrc_path]), \
patch('shutil.copy2') as mock_copy2:
# Call the method on the lyrics_processor
result = basic_karaoke_prep.lyrics_processor.transcribe_lyrics(None, artist, title, track_output_dir)
result = basic_karaoke_gen.lyrics_processor.transcribe_lyrics(None, artist, title, track_output_dir)
# Verify copy2 was called with correct arguments
mock_copy2.assert_any_call(lyrics_video_path, parent_video_path)
@@ -148,7 +148,7 @@ class TestLyrics:
assert result["lrc_filepath"] == parent_lrc_path
assert result["ass_filepath"] == parent_video_path
def test_transcribe_lyrics_new_transcription(self, basic_karaoke_prep, temp_dir):
def test_transcribe_lyrics_new_transcription(self, basic_karaoke_gen, temp_dir):
"""Test transcribing lyrics with a new transcription."""
# Setup
track_output_dir = os.path.join(temp_dir, "track")
@@ -191,15 +191,15 @@ class TestLyrics:
}
# Test with mocked dependencies
with patch('karaoke_prep.lyrics_processor.LyricsTranscriber', mock_transcriber), \
with patch('karaoke_gen.lyrics_processor.LyricsTranscriber', mock_transcriber), \
patch('os.makedirs'), \
patch('os.path.exists', return_value=False), \
patch('shutil.copy2') as mock_copy2, \
patch('os.getenv', side_effect=lambda key: mock_env.get(key)), \
patch('karaoke_prep.lyrics_processor.load_dotenv'):
patch('karaoke_gen.lyrics_processor.load_dotenv'):
# Call the method on the lyrics_processor
result = basic_karaoke_prep.lyrics_processor.transcribe_lyrics(input_audio_wav, artist, title, track_output_dir)
result = basic_karaoke_gen.lyrics_processor.transcribe_lyrics(input_audio_wav, artist, title, track_output_dir)
# Verify LyricsTranscriber was initialized with correct arguments
mock_transcriber.assert_called_once()
@@ -217,7 +217,7 @@ class TestLyrics:
assert result["corrected_lyrics_text"] == "Line 1\nLine 2"
assert result["corrected_lyrics_text_filepath"] == mock_results.corrected_txt
def test_backup_existing_outputs(self, basic_karaoke_prep, temp_dir):
def test_backup_existing_outputs(self, basic_karaoke_gen, temp_dir):
"""Test backing up existing outputs."""
# Setup
track_output_dir = os.path.join(temp_dir, "track")
@@ -248,7 +248,7 @@ class TestLyrics:
patch('shutil.copytree') as mock_copytree, \
patch('shutil.rmtree') as mock_rmtree:
result = basic_karaoke_prep.file_handler.backup_existing_outputs(track_output_dir, artist, title)
result = basic_karaoke_gen.file_handler.backup_existing_outputs(track_output_dir, artist, title)
# Verify the correct input audio file was returned
assert result == input_audio_wav
@@ -257,7 +257,7 @@ class TestLyrics:
version_dir = os.path.join(track_output_dir, "version-1")
# Verify files were moved to version directory
if not basic_karaoke_prep.dry_run:
if not basic_karaoke_gen.dry_run:
mock_move.assert_any_call(with_vocals_file, os.path.join(version_dir, os.path.basename(with_vocals_file)))
mock_move.assert_any_call(karaoke_file, os.path.join(version_dir, os.path.basename(karaoke_file)))
mock_move.assert_any_call(final_karaoke_file, os.path.join(version_dir, os.path.basename(final_karaoke_file)))
@@ -266,7 +266,7 @@ class TestLyrics:
mock_copytree.assert_called_once_with(lyrics_dir, os.path.join(version_dir, "lyrics"))
mock_rmtree.assert_called_once_with(lyrics_dir)
def test_backup_existing_outputs_no_input_audio(self, basic_karaoke_prep, temp_dir):
def test_backup_existing_outputs_no_input_audio(self, basic_karaoke_gen, temp_dir):
"""Test backing up existing outputs when input audio file is not found."""
# Setup
track_output_dir = os.path.join(temp_dir, "track")
@@ -287,12 +287,12 @@ class TestLyrics:
patch('shutil.rmtree'), \
patch('os.path.exists', return_value=False):
result = basic_karaoke_prep.file_handler.backup_existing_outputs(track_output_dir, artist, title)
result = basic_karaoke_gen.file_handler.backup_existing_outputs(track_output_dir, artist, title)
# Verify the alternative WAV file was returned
assert result == alt_wav_file
def test_backup_existing_outputs_no_wav_files(self, basic_karaoke_prep, temp_dir):
def test_backup_existing_outputs_no_wav_files(self, basic_karaoke_gen, temp_dir):
"""Test backing up existing outputs when no WAV files are found."""
# Setup
track_output_dir = os.path.join(temp_dir, "track")
@@ -306,4 +306,4 @@ class TestLyrics:
patch('os.path.exists', return_value=False):
with pytest.raises(Exception, match=f"No input audio file found in {track_output_dir}"):
basic_karaoke_prep.file_handler.backup_existing_outputs(track_output_dir, artist, title)
basic_karaoke_gen.file_handler.backup_existing_outputs(track_output_dir, artist, title)
+58 -58
View File
@@ -2,10 +2,10 @@ import pytest
from unittest.mock import MagicMock, patch, call
# Import the specific class for patching is not needed if we patch the target correctly
# from yt_dlp import YoutubeDL
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
class TestMetadata:
def test_extract_info_for_online_media_with_url(self, basic_karaoke_prep):
def test_extract_info_for_online_media_with_url(self, basic_karaoke_gen):
"""Test extracting info from online media with a URL."""
url = "https://example.com/video"
mock_info = {
@@ -22,12 +22,12 @@ class TestMetadata:
mock_ydl_instance.extract_info.return_value = mock_info
# Patch the 'ydl' alias used in metadata.py
with patch('karaoke_prep.metadata.ydl') as mock_ydl_context:
with patch('karaoke_gen.metadata.ydl') as mock_ydl_context:
# Configure the context manager mock
mock_ydl_context.return_value.__enter__.return_value = mock_ydl_instance
# Call the method
basic_karaoke_prep.extract_info_for_online_media(input_url=url)
basic_karaoke_gen.extract_info_for_online_media(input_url=url)
# Verify ydl was instantiated (implicitly checks context manager usage)
mock_ydl_context.assert_called_once_with({"quiet": True})
@@ -36,9 +36,9 @@ class TestMetadata:
mock_ydl_instance.extract_info.assert_called_once_with(url, download=False)
# Verify the extracted_info was set correctly
assert basic_karaoke_prep.extracted_info == mock_info
assert basic_karaoke_gen.extracted_info == mock_info
def test_extract_info_for_online_media_with_search(self, basic_karaoke_prep):
def test_extract_info_for_online_media_with_search(self, basic_karaoke_gen):
"""Test extracting info from online media with artist and title search."""
artist = "Test Artist"
title = "Test Title"
@@ -60,12 +60,12 @@ class TestMetadata:
mock_ydl_instance.extract_info.return_value = mock_search_result
# Patch the 'ydl' alias used in metadata.py
with patch('karaoke_prep.metadata.ydl') as mock_ydl_context:
with patch('karaoke_gen.metadata.ydl') as mock_ydl_context:
# Configure the context manager mock
mock_ydl_context.return_value.__enter__.return_value = mock_ydl_instance
# Call the method
basic_karaoke_prep.extract_info_for_online_media(input_artist=artist, input_title=title)
basic_karaoke_gen.extract_info_for_online_media(input_artist=artist, input_title=title)
# Verify ydl was instantiated with correct options
expected_ydl_opts = {"quiet": "True", "format": "bestaudio", "noplaylist": "True", "extract_flat": True}
@@ -76,9 +76,9 @@ class TestMetadata:
mock_ydl_instance.extract_info.assert_called_once_with(expected_query, download=False)
# Verify the extracted_info was set correctly
assert basic_karaoke_prep.extracted_info == mock_search_result["entries"][0]
assert basic_karaoke_gen.extracted_info == mock_search_result["entries"][0]
def test_extract_info_for_online_media_no_results(self, basic_karaoke_prep):
def test_extract_info_for_online_media_no_results(self, basic_karaoke_gen):
"""Test extracting info from online media with no search results."""
artist = "Test Artist"
title = "Test Title"
@@ -91,13 +91,13 @@ class TestMetadata:
mock_ydl_instance.extract_info.return_value = mock_search_result
# Patch the 'ydl' alias used in metadata.py
with patch('karaoke_prep.metadata.ydl') as mock_ydl_context:
with patch('karaoke_gen.metadata.ydl') as mock_ydl_context:
# Configure the context manager mock
mock_ydl_context.return_value.__enter__.return_value = mock_ydl_instance
# Assert that calling the method with no results raises an IndexError
with pytest.raises(IndexError):
basic_karaoke_prep.extract_info_for_online_media(input_artist=artist, input_title=title)
basic_karaoke_gen.extract_info_for_online_media(input_artist=artist, input_title=title)
# Verify ydl was instantiated with correct options
expected_ydl_opts = {"quiet": "True", "format": "bestaudio", "noplaylist": "True", "extract_flat": True}
@@ -107,26 +107,26 @@ class TestMetadata:
expected_query = f"ytsearch1:{artist} {title}"
mock_ydl_instance.extract_info.assert_called_once_with(expected_query, download=False)
def test_parse_single_track_metadata_complete(self, basic_karaoke_prep):
def test_parse_single_track_metadata_complete(self, basic_karaoke_gen):
"""Test parsing metadata from extracted info with complete information."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Artist - Test Title",
"extractor_key": "Youtube",
"id": "12345",
"url": "https://example.com/video"
}
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
assert basic_karaoke_prep.url == "https://example.com/video"
assert basic_karaoke_prep.extractor == "Youtube"
assert basic_karaoke_prep.media_id == "12345"
assert basic_karaoke_prep.artist == "Test Artist"
assert basic_karaoke_prep.title == "Test Title"
assert basic_karaoke_gen.url == "https://example.com/video"
assert basic_karaoke_gen.extractor == "Youtube"
assert basic_karaoke_gen.media_id == "12345"
assert basic_karaoke_gen.artist == "Test Artist"
assert basic_karaoke_gen.title == "Test Title"
def test_parse_single_track_metadata_with_input_values(self, basic_karaoke_prep):
def test_parse_single_track_metadata_with_input_values(self, basic_karaoke_gen):
"""Test parsing metadata with provided input values."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Wrong Artist - Wrong Title",
"extractor_key": "Youtube",
"id": "12345",
@@ -138,88 +138,88 @@ class TestMetadata:
# Set artist and title on the instance *before* calling parse,
# because the method uses these values in its final check.
basic_karaoke_prep.artist = input_artist
basic_karaoke_prep.title = input_title
basic_karaoke_gen.artist = input_artist
basic_karaoke_gen.title = input_title
# Call the method
basic_karaoke_prep.parse_single_track_metadata(input_artist, input_title)
basic_karaoke_gen.parse_single_track_metadata(input_artist, input_title)
# Verify URL, extractor, and ID are parsed correctly
assert basic_karaoke_prep.url == "https://example.com/video"
assert basic_karaoke_prep.extractor == "Youtube"
assert basic_karaoke_prep.media_id == "12345"
assert basic_karaoke_gen.url == "https://example.com/video"
assert basic_karaoke_gen.extractor == "Youtube"
assert basic_karaoke_gen.media_id == "12345"
# Verify the artist and title remain the input values
assert basic_karaoke_prep.artist == input_artist
assert basic_karaoke_prep.title == input_title
assert basic_karaoke_gen.artist == input_artist
assert basic_karaoke_gen.title == input_title
def test_parse_single_track_metadata_with_persistent_artist(self, basic_karaoke_prep):
def test_parse_single_track_metadata_with_persistent_artist(self, basic_karaoke_gen):
"""Test parsing metadata with persistent artist."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Artist - Test Title",
"extractor_key": "Youtube",
"id": "12345",
"url": "https://example.com/video"
}
basic_karaoke_prep.persistent_artist = "Persistent Artist"
basic_karaoke_gen.persistent_artist = "Persistent Artist"
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
assert basic_karaoke_prep.artist == "Persistent Artist"
assert basic_karaoke_prep.title == "Test Title"
assert basic_karaoke_gen.artist == "Persistent Artist"
assert basic_karaoke_gen.title == "Test Title"
def test_parse_single_track_metadata_with_ie_key(self, basic_karaoke_prep):
def test_parse_single_track_metadata_with_ie_key(self, basic_karaoke_gen):
"""Test parsing metadata with ie_key instead of extractor_key."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Artist - Test Title",
"ie_key": "Youtube",
"id": "12345",
"url": "https://example.com/video"
}
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
assert basic_karaoke_prep.extractor == "Youtube"
assert basic_karaoke_gen.extractor == "Youtube"
def test_parse_single_track_metadata_with_webpage_url(self, basic_karaoke_prep):
def test_parse_single_track_metadata_with_webpage_url(self, basic_karaoke_gen):
"""Test parsing metadata with webpage_url instead of url."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Artist - Test Title",
"extractor_key": "Youtube",
"id": "12345",
"webpage_url": "https://example.com/video"
}
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
assert basic_karaoke_prep.url == "https://example.com/video"
assert basic_karaoke_gen.url == "https://example.com/video"
def test_parse_single_track_metadata_missing_url(self, basic_karaoke_prep):
def test_parse_single_track_metadata_missing_url(self, basic_karaoke_gen):
"""Test parsing metadata with missing URL."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Artist - Test Title",
"extractor_key": "Youtube",
"id": "12345"
}
with pytest.raises(Exception, match="Failed to extract URL from input media metadata"):
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
def test_parse_single_track_metadata_missing_extractor(self, basic_karaoke_prep):
def test_parse_single_track_metadata_missing_extractor(self, basic_karaoke_gen):
"""Test parsing metadata with missing extractor."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Artist - Test Title",
"id": "12345",
"url": "https://example.com/video"
}
with pytest.raises(Exception, match="Failed to find extractor name from input media metadata"):
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
def test_parse_single_track_metadata_with_uploader(self, basic_karaoke_prep):
def test_parse_single_track_metadata_with_uploader(self, basic_karaoke_gen):
"""Test parsing metadata with uploader as artist fallback."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"title": "Test Title", # No artist in title
"extractor_key": "Youtube",
"id": "12345",
@@ -227,18 +227,18 @@ class TestMetadata:
"uploader": "Test Uploader"
}
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
assert basic_karaoke_prep.artist == "Test Uploader"
assert basic_karaoke_prep.title == "Test Title"
assert basic_karaoke_gen.artist == "Test Uploader"
assert basic_karaoke_gen.title == "Test Title"
def test_parse_single_track_metadata_missing_artist_title(self, basic_karaoke_prep):
def test_parse_single_track_metadata_missing_artist_title(self, basic_karaoke_gen):
"""Test parsing metadata with missing artist and title."""
basic_karaoke_prep.extracted_info = {
basic_karaoke_gen.extracted_info = {
"extractor_key": "Youtube",
"id": "12345",
"url": "https://example.com/video"
}
with pytest.raises(Exception, match="Failed to extract artist and title from the input media metadata"):
basic_karaoke_prep.parse_single_track_metadata(None, None)
basic_karaoke_gen.parse_single_track_metadata(None, None)
+48 -48
View File
@@ -3,10 +3,10 @@ import pytest
from unittest.mock import MagicMock, patch, call, mock_open
from PIL import Image, ImageDraw, ImageFont
import json
from karaoke_prep.karaoke_prep import KaraokePrep
from karaoke_gen.karaoke_gen import KaraokePrep
class TestVideo:
def test_create_video_with_defaults(self, basic_karaoke_prep, temp_dir):
def test_create_video_with_defaults(self, basic_karaoke_gen, temp_dir):
"""Test creating a video with default parameters."""
# Setup
output_image_filepath_noext = os.path.join(temp_dir, "output")
@@ -37,11 +37,11 @@ class TestVideo:
mock_draw.return_value = mock_draw_obj
# Call the method
basic_karaoke_prep.video_generator.create_video(
basic_karaoke_gen.video_generator.create_video(
extra_text="Extra Text",
title_text="Test Title",
artist_text="Test Artist",
format=basic_karaoke_prep.title_format,
format=basic_karaoke_gen.title_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
duration=5
@@ -55,7 +55,7 @@ class TestVideo:
# Verify os.system was called (access the patch object directly)
# Note: os.system is patched within the 'with' block, so we access it there
# We can't assert call_count directly on basic_karaoke_prep._os_system
# We can't assert call_count directly on basic_karaoke_gen._os_system
# Instead, we rely on the patch context manager
# Let's verify the call arguments if possible, or just that it was called.
# Since os.system is patched without assigning to a variable, we check its call count via the patcher object if needed,
@@ -65,7 +65,7 @@ class TestVideo:
# Let's refine the assertion later if needed, for now, ensure the TypeError is gone.
pass # Original assertion was incorrect, removing for now.
def test_create_video_with_existing_image(self, basic_karaoke_prep, temp_dir):
def test_create_video_with_existing_image(self, basic_karaoke_gen, temp_dir):
"""Test creating a video with an existing image."""
# Setup
existing_image = os.path.join(temp_dir, "existing.png")
@@ -87,11 +87,11 @@ class TestVideo:
mock_image.mode = "RGBA"
# Call the method
basic_karaoke_prep.video_generator.create_video(
basic_karaoke_gen.video_generator.create_video(
extra_text=None,
title_text=None,
artist_text=None,
format=basic_karaoke_prep.title_format,
format=basic_karaoke_gen.title_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
existing_image=existing_image,
@@ -104,7 +104,7 @@ class TestVideo:
# Verify os.system was called to create the video
mock_os_system.assert_called_once() # Check the patch object directly
def test_create_video_with_background_image(self, basic_karaoke_prep, temp_dir):
def test_create_video_with_background_image(self, basic_karaoke_gen, temp_dir):
"""Test creating a video with a background image."""
# Setup
background_image = os.path.join(temp_dir, "background.png")
@@ -116,7 +116,7 @@ class TestVideo:
f.write("mock background image content")
# Create a format with background image
format = basic_karaoke_prep.title_format.copy()
format = basic_karaoke_gen.title_format.copy()
format["background_image"] = background_image
# Mock dependencies
@@ -143,7 +143,7 @@ class TestVideo:
mock_draw.return_value = mock_draw_obj
# Call the method
basic_karaoke_prep.video_generator.create_video(
basic_karaoke_gen.video_generator.create_video(
extra_text="Extra Text",
title_text="Test Title",
artist_text="Test Artist",
@@ -162,11 +162,11 @@ class TestVideo:
# Verify os.system was called to create the video
mock_os_system.assert_called_once() # Check the patch object
def test_create_video_with_no_output_images(self, basic_karaoke_prep, temp_dir):
def test_create_video_with_no_output_images(self, basic_karaoke_gen, temp_dir):
"""Test creating a video without saving output images."""
# Setup
# Re-init KaraokePrep with specific output flags for this test
kp_no_images = KaraokePrep(logger=basic_karaoke_prep.logger, output_png=False, output_jpg=False)
kp_no_images = KaraokePrep(logger=basic_karaoke_gen.logger, output_png=False, output_jpg=False)
output_image_filepath_noext = os.path.join(temp_dir, "output")
output_video_filepath = os.path.join(temp_dir, "output.mov")
@@ -198,7 +198,7 @@ class TestVideo:
extra_text="Extra Text",
title_text="Test Title",
artist_text="Test Artist",
format=basic_karaoke_prep.title_format,
format=basic_karaoke_gen.title_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
duration=5
@@ -210,7 +210,7 @@ class TestVideo:
# Verify os.system was called to create the video
mock_os_system.assert_called_once() # Check the patch object
def test_create_video_with_zero_duration(self, basic_karaoke_prep, temp_dir):
def test_create_video_with_zero_duration(self, basic_karaoke_gen, temp_dir):
"""Test creating a video with zero duration (no video, just images)."""
# Setup
output_image_filepath_noext = os.path.join(temp_dir, "output")
@@ -239,11 +239,11 @@ class TestVideo:
mock_draw.return_value = mock_draw_obj
# Call the method
basic_karaoke_prep.video_generator.create_video(
basic_karaoke_gen.video_generator.create_video(
extra_text="Extra Text",
title_text="Test Title",
artist_text="Test Artist",
format=basic_karaoke_prep.title_format,
format=basic_karaoke_gen.title_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
duration=0
@@ -255,95 +255,95 @@ class TestVideo:
# Verify os.system was not called to create the video
mock_os_system.assert_not_called() # Check the patch object
def test_create_title_video(self, basic_karaoke_prep, temp_dir):
def test_create_title_video(self, basic_karaoke_gen, temp_dir):
"""Test creating a title video."""
# Setup
output_image_filepath_noext = os.path.join(temp_dir, "output")
output_video_filepath = os.path.join(temp_dir, "output.mov")
# Mock dependencies
with patch.object(basic_karaoke_prep.video_generator, 'create_video') as mock_create_video:
with patch.object(basic_karaoke_gen.video_generator, 'create_video') as mock_create_video:
# Call the method
basic_karaoke_prep.video_generator.create_title_video(
basic_karaoke_gen.video_generator.create_title_video(
artist="Test Artist",
title="Test Title",
format=basic_karaoke_prep.title_format,
format=basic_karaoke_gen.title_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
existing_title_image=basic_karaoke_prep.existing_title_image,
intro_video_duration=basic_karaoke_prep.intro_video_duration
existing_title_image=basic_karaoke_gen.existing_title_image,
intro_video_duration=basic_karaoke_gen.intro_video_duration
)
# Verify create_video was called with transformed text and correct duration
mock_create_video.assert_called_once_with(
title_text="Test Title",
artist_text="Test Artist",
extra_text=basic_karaoke_prep.title_format["extra_text"],
format=basic_karaoke_prep.title_format,
extra_text=basic_karaoke_gen.title_format["extra_text"],
format=basic_karaoke_gen.title_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
existing_image=basic_karaoke_prep.existing_title_image,
duration=basic_karaoke_prep.intro_video_duration,
existing_image=basic_karaoke_gen.existing_title_image,
duration=basic_karaoke_gen.intro_video_duration,
)
def test_create_end_video(self, basic_karaoke_prep, temp_dir):
def test_create_end_video(self, basic_karaoke_gen, temp_dir):
"""Test creating an end video."""
# Setup
output_image_filepath_noext = os.path.join(temp_dir, "output")
output_video_filepath = os.path.join(temp_dir, "output.mov")
# Mock dependencies
with patch.object(basic_karaoke_prep.video_generator, 'create_video') as mock_create_video:
with patch.object(basic_karaoke_gen.video_generator, 'create_video') as mock_create_video:
# Call the method
basic_karaoke_prep.video_generator.create_end_video(
basic_karaoke_gen.video_generator.create_end_video(
artist="Test Artist",
title="Test Title",
format=basic_karaoke_prep.end_format,
format=basic_karaoke_gen.end_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
existing_end_image=basic_karaoke_prep.existing_end_image,
end_video_duration=basic_karaoke_prep.end_video_duration
existing_end_image=basic_karaoke_gen.existing_end_image,
end_video_duration=basic_karaoke_gen.end_video_duration
)
# Verify create_video was called with transformed text and correct duration
mock_create_video.assert_called_once_with(
title_text="Test Title",
artist_text="Test Artist",
extra_text=basic_karaoke_prep.end_format["extra_text"],
format=basic_karaoke_prep.end_format,
extra_text=basic_karaoke_gen.end_format["extra_text"],
format=basic_karaoke_gen.end_format,
output_image_filepath_noext=output_image_filepath_noext,
output_video_filepath=output_video_filepath,
existing_image=basic_karaoke_prep.existing_end_image,
duration=basic_karaoke_prep.end_video_duration,
existing_image=basic_karaoke_gen.existing_end_image,
duration=basic_karaoke_gen.end_video_duration,
)
def test_hex_to_rgb(self, basic_karaoke_prep):
def test_hex_to_rgb(self, basic_karaoke_gen):
"""Test converting hex color to RGB tuple."""
# Test with hash prefix
assert basic_karaoke_prep.video_generator.hex_to_rgb("#FF0000") == (255, 0, 0)
assert basic_karaoke_gen.video_generator.hex_to_rgb("#FF0000") == (255, 0, 0)
# Test without hash prefix
assert basic_karaoke_prep.video_generator.hex_to_rgb("00FF00") == (0, 255, 0)
assert basic_karaoke_gen.video_generator.hex_to_rgb("00FF00") == (0, 255, 0)
# Test mixed case
assert basic_karaoke_prep.video_generator.hex_to_rgb("0000Ff") == (0, 0, 255)
assert basic_karaoke_gen.video_generator.hex_to_rgb("0000Ff") == (0, 0, 255)
def test_transform_text(self, basic_karaoke_prep):
def test_transform_text(self, basic_karaoke_gen):
"""Test transforming text based on specified type."""
# Test uppercase
assert basic_karaoke_prep.video_generator._transform_text("test", "uppercase") == "TEST"
assert basic_karaoke_gen.video_generator._transform_text("test", "uppercase") == "TEST"
# Test lowercase
assert basic_karaoke_prep.video_generator._transform_text("TEST", "lowercase") == "test"
assert basic_karaoke_gen.video_generator._transform_text("TEST", "lowercase") == "test"
# Test propercase (title)
assert basic_karaoke_prep.video_generator._transform_text("test title", "propercase") == "Test Title"
assert basic_karaoke_gen.video_generator._transform_text("test title", "propercase") == "Test Title"
# Test None
assert basic_karaoke_prep.video_generator._transform_text("test", "none") == "test"
assert basic_karaoke_gen.video_generator._transform_text("test", "none") == "test"
# Test unknown
assert basic_karaoke_prep.video_generator._transform_text("test", "unknown") == "test"
assert basic_karaoke_gen.video_generator._transform_text("test", "unknown") == "test"
# Test None input
assert basic_karaoke_prep.video_generator._transform_text(None, "uppercase") is None
assert basic_karaoke_gen.video_generator._transform_text(None, "uppercase") is None