mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-05-22 22:32:18 +02:00
22 lines
603 B
Python
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(".")
|