clipwright/tests/test_clip_render_order.py
pedro-bento 83ad1feaba
All checks were successful
CI / backend-tests (pull_request) Successful in 30s
CI / frontend-build (pull_request) Successful in 29s
refactor: move backend into the clipwright package
Restructure the 37 root-level Python modules into a proper package:
  clipwright/{core,api,pipeline,layouts,media,integrations,tools}

- Rewrite every local import (module-level and deferred) to absolute
  clipwright.<group>.<mod> form; no legacy root shims or re-exports.
- Add clipwright/core/paths.py and route fonts/assets/cookies through it.
- Entry points: uvicorn clipwright.api.app:app; jobs run as
  python -m clipwright.pipeline.main; probe as -m ...quality_probe.
- child_env() appends REPO_ROOT to PYTHONPATH so the -m workers work.
- transcribe_backends: sys.modules key now clipwright.media.scene_detection.
- Tooling: root pyproject.toml (pytest pythonpath=[.], ruff), shared
  requirements-test.txt, CI installs it, Docker PYTHONPATH=/app.
- Tests: all imports/fakes/source-scans repointed; new tests/test_package_layout.py
  enforces no root modules, docstring-only __init__, and no legacy imports.
- Docs/comments updated for the new layout.

Backend: 744 passed, 19 skipped. Frontend lint+build green.
2026-10-04 20:40:38 +01:00

18 lines
568 B
Python

"""The strongest clip renders first, so it is the first one the user sees."""
import pytest
main = pytest.importorskip("clipwright.pipeline.main")
def test_best_score_first():
shorts = [{"predicted_score": 40}, {"predicted_score": 91}, {"predicted_score": 77}]
assert main.clip_render_order(shorts) == [1, 2, 0]
def test_unscored_keep_order_after_scored():
shorts = [{}, {"predicted_score": "60"}, {"predicted_score": None}, {}]
assert main.clip_render_order(shorts) == [1, 0, 2, 3]
def test_empty():
assert main.clip_render_order([]) == []