Files
supervision/tests/assets/test_list.py
T
0a95bae8a8 chore: bump minimum Python to 3.10 (#2260)
- Drop Python 3.9 from CI test matrix
- requires-python = ">=3.10" in pyproject.toml
- ruff target-version py39 → py310
- mypy python_version 3.9 → 3.10
- Remove Python 3.9 classifier

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-29 14:45:30 +02:00

69 lines
2.2 KiB
Python

from supervision.assets.list import (
BASE_IMAGE_URL,
BASE_VIDEO_URL,
MEDIA_ASSETS,
ImageAssets,
VideoAssets,
)
def test_video_assets_list() -> None:
"""Test that VideoAssets.list() returns all video filenames."""
expected_filenames = [
"vehicles.mp4",
"milk-bottling-plant.mp4",
"vehicles-2.mp4",
"grocery-store.mp4",
"subway.mp4",
"market-square.mp4",
"people-walking.mp4",
"beach-1.mp4",
"basketball-1.mp4",
"skiing.mp4",
]
assert VideoAssets.list() == expected_filenames
def test_image_assets_list() -> None:
"""Test that ImageAssets.list() returns all image filenames."""
expected_filenames = [
"people-walking.jpg",
"soccer.jpg",
]
assert ImageAssets.list() == expected_filenames
def test_video_assets_values() -> None:
"""Test that VideoAssets enum members have correct attributes."""
assert VideoAssets.VEHICLES.filename == "vehicles.mp4"
assert VideoAssets.VEHICLES.md5_hash == "8155ff4e4de08cfa25f39de96483f918"
assert VideoAssets.VEHICLES.value == "vehicles.mp4"
def test_image_assets_values() -> None:
"""Test that ImageAssets enum members have correct attributes."""
assert ImageAssets.SOCCER.filename == "soccer.jpg"
assert ImageAssets.SOCCER.md5_hash == "0f5a4b98abf3e3973faf9e9260a7d876"
assert ImageAssets.SOCCER.value == "soccer.jpg"
def test_media_assets_dict_keys() -> None:
"""Test that MEDIA_ASSETS has all VideoAssets and ImageAssets as keys."""
expected_keys = {asset.filename for asset in VideoAssets} | {
asset.filename for asset in ImageAssets
}
assert set(MEDIA_ASSETS.keys()) == expected_keys
def test_media_assets_dict_values() -> None:
"""Test that MEDIA_ASSETS values are tuples of (url, md5_hash)."""
for filename, (url, md5_hash) in MEDIA_ASSETS.items():
assert isinstance(url, str)
if filename.endswith(".mp4"):
assert url.startswith(BASE_VIDEO_URL)
elif filename.endswith(".jpg"):
assert url.startswith(BASE_IMAGE_URL)
assert url.endswith(filename)
assert isinstance(md5_hash, str)
assert len(md5_hash) == 32 # MD5 hash length