Permalink
Browse files

rename unit tests

  • Loading branch information...
sdpython committed Jan 21, 2018
1 parent b3065a5 commit fd22639e508af7f823e81a9c3375952b41d91302
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=1000s)
@brief test log(time=1002s)
Duraction is around a few seconds but the test needs to be run
at the end of the series of unitests as it interferes
@@ -49,7 +49,7 @@
from src.code_beatrix.art.video import video_save, video_image, video_position, video_resize, clean_video
class TestVideoImage(ExtTestCase):
class TestVideoImagePosition(ExtTestCase):
def test_video_image_position(self):
fLOG(
@@ -85,33 +85,6 @@ def test_video_image_position(self):
self.assertExists(exp)
clean_video([vid, img])
def test_video_image_resize(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_video_resize")
nimg = os.path.join(temp, '..', 'data', 'GastonLagaffe_1121.jpg')
vid = video_image(nimg, duration=60, zoom=(200, 200))
exp = os.path.join(temp, "courte.mp4")
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video(vid)
exp = os.path.join(temp, "courtecb.mp4")
img = video_image(nimg, duration=60, zoom=(200, 200))
vid = video_resize(img, 0.5)
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video([vid, img])
exp = os.path.join(temp, "courtefct.mp4")
img = video_image(nimg, duration=60, zoom=(200, 200))
vid = video_resize(img, lambda t: max(0.1, 1 - 0.1 * t))
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video([vid, img])
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=1001s)
Duraction is around a few seconds but the test needs to be run
at the end of the series of unitests as it interferes
with the notebook unittesting (it uses Popen too).
"""
import sys
import os
import unittest
try:
import pyquickhelper
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
"pyquickhelper",
"src")))
if path not in sys.path:
sys.path.append(path)
import pyquickhelper
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from src.code_beatrix.art.video import video_save, video_image, video_position, video_resize, clean_video
class TestVideoImageResize(ExtTestCase):
def test_video_image_resize(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_video_resize")
nimg = os.path.join(temp, '..', 'data', 'GastonLagaffe_1121.jpg')
vid = video_image(nimg, duration=60, zoom=(200, 200))
exp = os.path.join(temp, "courte.mp4")
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video(vid)
exp = os.path.join(temp, "courtecb.mp4")
img = video_image(nimg, duration=60, zoom=(200, 200))
vid = video_resize(img, 0.5)
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video([vid, img])
exp = os.path.join(temp, "courtefct.mp4")
img = video_image(nimg, duration=60, zoom=(200, 200))
vid = video_resize(img, lambda t: max(0.1, 1 - 0.1 * t))
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video([vid, img])
if __name__ == "__main__":
unittest.main()

0 comments on commit fd22639

Please sign in to comment.