Commit beabd565 authored by Niels-Oliver Walkowski's avatar Niels-Oliver Walkowski
Browse files

feat(test): add basic tests

Add unit test for the Frame class.
Add integration test for seqmean of luminance and saturation.
parent aa232eca
import sys
from import Movie
from itten.views import UnivariateSequence # , MultivariateSequence
# from itten.visuals import UnivariatePlot # , MultivariatePlot
import pytest
import numpy as np
# TODO Eine allgemeine Funktion zum Testen der Frames Klasse, der
# Kontrastberechnung und der Visualisierung, jeweils mit Parametrisierung für
# alle Kontraste
TESTMOVIE = 'syriana'
def m(prefix=TESTMOVIE):
prefix += '_'
m = Movie(prefix, './tests/data/' + TESTMOVIE + '/frames/240p30/', fps=200)
yield m
m = None
def test_frame_cls(m):
err_msg = "Frames are not counted correctly"
assert m.fsize == m._frames.frm_length, err_msg
assert m._frames.frm_cnt == len(m._frames.frames), err_msg
@pytest.mark.parametrize('ctrst, meth', [('monochromatic', 'luminance'),
('saturation', 'saturation')])
def test_seqmean(m, ctrst, meth):
view = UnivariateSequence(m._frames)
view.seqmean(ctrst, method=meth, frm_stp=200,)
err_msg = "Wrong number of frames after Movie object initialization"
assert m._frames.count_frames() == 29398, err_msg
err_msg = "Wrong number of mean values for current fps/movie length ratio"
assert view.size == 147, err_msg
err_msg = "Mean contrast values are not computed appropriately"
assert int(np.median(view)) > 0, err_msg
# viz = UnivariatePlot(view,)
# viz.fig.set_size_inches(40, 5)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment