<commit_before>"""
Tests meant to be run with pytest
"""

import sys
import os
import pytest

from moviepy.editor import *


#@pytest.fixture
#def example_video1():
#    pass

global knights, knights10

def download_youtube_video(url, filename):
    if not os.path.exists(filename):
       print("\nDownloading %s\n" % filename)
       download_webfile(url, filename)
       print("Downloading complete...\n")


def test_download_media(capsys):
    with capsys.disabled():
       download_youtube_video("zvCvOC2VwDc", "media/knights.mp4")

    knights=VideoFileClip("media/knights.mp4")
    knights10 = knights.subclip(60,70)



def test_issue_145():
    with pytest.raises(Exception, message="Expecting Exception"):
         _final = concatenation([knights10], method = 'composite')

def test_PR_306():
    assert TextClip.list('font') != []
    assert TextClip.list('color') != []

    with pytest.raises(Exception, message="Expecting Exception"):
         TextClip.list('blah')

if __name__ == '__main__':
   pytest.main()<commit_msg>Test issue 407 (video has a valid fps after concatenate function) (#443)<commit_after>"""
Tests meant to be run with pytest
"""

import sys
import os
import pytest

from moviepy.editor import *


#@<EMAIL>.fixture
#def example_video1():
#    pass

global knights, knights10

def download_youtube_video(url, filename):
    if not os.path.exists(filename):
       print("\nDownloading %s\n" % filename)
       download_webfile(url, filename)
       print("Downloading complete...\n")


def test_download_media(capsys):
    global knights, knights10

    with capsys.disabled():
       download_youtube_video("zvCvOC2VwDc", "media/knights.mp4")

    knights=VideoFileClip("media/knights.mp4")
    knights10 = knights.subclip(60,70)


def test_issue_145():
    with pytest.raises(Exception, message="Expecting Exception"):
         _final = concatenation([knights10], method = 'composite')

def test_issue_407():
    assert round(knights.fps) == 30
    assert knights10.fps == knights.fps

    _text=TextClip("blah").set_duration(2)  #TextClip has no fps attribute

    _video=concatenate_videoclips([_text, knights10, knights10])
    assert _video.fps == knights10.fps

    # uncomment when PR 416 is merged.
    #_video=concatenate_videoclips([_text])
    #assert _video.fps == None


def test_PR_306():
    assert TextClip.list('font') != []
    assert TextClip.list('color') != []

    with pytest.raises(Exception, message="Expecting Exception"):
         TextClip.list('blah')

if __name__ == '__main__':
   pytest.main()
{'fraction_non_alphanumeric': 0.128125, 'fraction_numerical': 0.025390625, 'mean_word_length': 4.061264822134388, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5777330', 'n_tokens_mistral': 900, 'n_tokens_neox': 841, 'n_words': 185}