2021-06-04 14:03:41 +02:00
|
|
|
import pytest
|
2021-10-17 16:24:37 +02:00
|
|
|
|
2023-02-03 18:01:13 +01:00
|
|
|
from libretime_analyzer.pipeline.analyze_cuepoint import (
|
|
|
|
analyze_cuepoint,
|
|
|
|
analyze_duration,
|
|
|
|
)
|
2014-12-11 00:44:35 +01:00
|
|
|
|
2022-01-21 09:09:42 +01:00
|
|
|
from ..fixtures import FILES
|
2021-08-30 21:23:48 +02:00
|
|
|
|
2021-05-27 16:23:02 +02:00
|
|
|
|
2021-06-04 14:03:41 +02:00
|
|
|
@pytest.mark.parametrize(
|
2021-08-30 21:23:48 +02:00
|
|
|
"filepath,length,cuein,cueout",
|
2022-01-21 09:09:42 +01:00
|
|
|
map(
|
|
|
|
lambda i: pytest.param(
|
|
|
|
str(i.path), i.length, i.cuein, i.cueout, id=i.path.name
|
|
|
|
),
|
|
|
|
FILES,
|
|
|
|
),
|
2021-06-04 14:03:41 +02:00
|
|
|
)
|
2022-01-21 05:41:51 +01:00
|
|
|
def test_analyze_cuepoint(filepath, length, cuein, cueout):
|
2023-02-03 18:01:13 +01:00
|
|
|
metadata = analyze_duration(filepath, {})
|
|
|
|
metadata = analyze_cuepoint(filepath, metadata)
|
2021-06-04 14:03:41 +02:00
|
|
|
|
2021-08-30 21:23:48 +02:00
|
|
|
assert metadata["length_seconds"] == pytest.approx(length, abs=0.1)
|
2022-01-21 09:09:42 +01:00
|
|
|
assert float(metadata["cuein"]) == pytest.approx(float(cuein), abs=1)
|
|
|
|
assert float(metadata["cueout"]) == pytest.approx(float(cueout), abs=1)
|