Commit f7dc30cf authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): try fix the delta

parent 985472bf
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -3,9 +3,18 @@ import os.path
import pytest

from imgutils.metrics import get_aesthetic_score
from imgutils.metrics.aesthetic import _open_aesthetic_model
from test.testings import get_testfile


@pytest.fixture(scope='module', autouse=True)
def _release_model():
    try:
        yield
    finally:
        _open_aesthetic_model.cache_clear()


@pytest.mark.unittest
class TestMetricsAesthetic:
    @pytest.mark.parametrize(['file', 'score'], [
@@ -19,4 +28,5 @@ class TestMetricsAesthetic:
        ('5512471-0.919.jpg', 0.9187621474266052),
    ])
    def test_get_aesthetic_score(self, file, score):
        assert get_aesthetic_score(get_testfile(os.path.join('aesthetic', file))) == pytest.approx(score)
        assert get_aesthetic_score(get_testfile(os.path.join('aesthetic', file))) == \
               pytest.approx(score, abs=1e-3)