batdetect2/tests/test_outputs/test_base.py
2026-05-06 19:11:55 +01:00

22 lines
603 B
Python

from pathlib import Path
from batdetect2.outputs.formats.base import make_path_relative
def test_make_path_relative_strips_shared_relative_prefix() -> None:
audio_dir = Path("example_data/audio")
path = Path("example_data/audio/subdir/clip.wav")
relative = make_path_relative(path, audio_dir)
assert relative == Path("subdir/clip.wav")
def test_make_path_relative_returns_dot_for_matching_relative_dir() -> None:
audio_dir = Path("example_data/audio")
path = Path("example_data/audio")
relative = make_path_relative(path, audio_dir)
assert relative == Path(".")