2021-06-04 14:04:07 +02:00
|
|
|
import pytest
|
2021-10-17 16:24:37 +02:00
|
|
|
|
2022-01-28 06:09:19 +01:00
|
|
|
from libretime_analyzer.pipeline.analyze_replaygain import analyze_replaygain
|
2014-12-11 20:12:41 +01:00
|
|
|
|
2022-01-21 09:07:27 +01:00
|
|
|
from ..fixtures import FILES
|
2021-08-30 21:23:48 +02:00
|
|
|
|
2017-02-28 14:07:34 +01:00
|
|
|
|
2021-06-04 14:04:07 +02:00
|
|
|
@pytest.mark.parametrize(
|
2021-08-30 21:23:48 +02:00
|
|
|
"filepath,replaygain",
|
2022-01-21 09:07:27 +01:00
|
|
|
map(lambda i: pytest.param(str(i.path), i.replaygain, id=i.path.name), FILES),
|
2021-06-04 14:04:07 +02:00
|
|
|
)
|
2022-01-21 05:41:51 +01:00
|
|
|
def test_analyze_replaygain(filepath, replaygain):
|
2022-01-21 09:07:27 +01:00
|
|
|
tolerance = 0.8
|
2021-05-27 16:23:02 +02:00
|
|
|
|
2022-08-09 20:49:04 +02:00
|
|
|
metadata = analyze_replaygain(filepath, {})
|
2022-01-21 09:07:27 +01:00
|
|
|
assert metadata["replay_gain"] == pytest.approx(replaygain, abs=tolerance)
|