# -*- coding: utf-8 -*-
"""
@brief      test log(time=1s)
"""
import os
import unittest
import warnings
from pyquickhelper.pycode import (
    get_temp_folder, ExtTestCase, skipif_circleci,
    skipif_appveyor, skipif_travis)
from pytube.exceptions import RegexMatchError  # pylint: disable=C0411
from code_beatrix.art.video import download_youtube_video


class TestVideoDownload(ExtTestCase):

    @skipif_circleci("unexpected error: KeyError: 'url_encoded_fmt_stream_map'")
    @skipif_appveyor("connectivity issues")
    @skipif_travis("connectivity issues")
    def test_video_download(self):
        temp = get_temp_folder(__file__, "temp_video_download")
        try:
            download_youtube_video('vHcfbOqYztU', output_path=temp)
        except RegexMatchError as e:
            if "zero match" not in str(e):
                raise e
            import pytube
            warnings.warn("RegexMatchError: pytube version {} - pytube issue: {}".format(
                pytube.__version__, e))
            return
        except KeyError as e:
            import pytube
            warnings.warn("KeyError: pytube version {} - pytube issue: {}".format(
                pytube.__version__, e))
            return
        exp = os.path.join(temp, "vidéo tres courte.mp4")
        self.assertExists(exp)


if __name__ == "__main__":
    unittest.main()

@@ -264,16 +264,34 @@
 tchError
+, VideoUnavailable
   # pyli
@@ -1025,32 +1025,246 @@
          return%0A
+        except VideoUnavailable as e:%0A            import pytube%0A            warnings.warn(%22VideoUnavailable: pytube version %7B%7D - pytube issue: %7B%7D%22.format(%0A                pytube.__version__, e))%0A            return%0A
         except K
@@ -1269,32 +1269,32 @@
  KeyError as e:%0A
-
             impo
@@ -1515,29 +1515,167 @@
     
-self.assertExists(exp
+if __name__ == %22__main___%22:%0A            self.assertExists(exp)%0A        if not os.path.exists(exp):%0A            warnings.warn(%22Unable to find '%7B%7D'.%22.format(exp)
 )%0A%0A%0A

Update test_video_download.py