Commit 985472bf authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): add test for aesthetic

parent 0f51fbc0
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
import os.path

import pytest

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


@pytest.mark.unittest
class TestMetricsAesthetic:
    @pytest.mark.parametrize(['file', 'score'], [
        ('2053756-0.100.jpg', 0.09986039996147156),
        ('1663584-0.243.jpg', 0.24299287796020508),
        ('4886411-0.381.jpg', 0.38091593980789185),
        ('2066024-0.513.jpg', 0.5131649971008301),
        ('3670169-0.601.jpg', 0.6011670827865601),
        ('5930006-0.707.jpg', 0.7067991495132446),
        ('3821265-0.824.jpg', 0.8237218260765076),
        ('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)
+49 KiB
Loading image diff...
+42.7 KiB
Loading image diff...
+45.6 KiB
Loading image diff...
+108 KiB
Loading image diff...
Loading