Project Name: Zulko+moviepy
Language: Python
Statement Type: API

Source Code:
def test_freeze(t, freeze_duration, total_duration, padding_end, output_frames):
    input_frames = ["R", "G", "B"]
    clip_duration = len(input_frames)

    # create BitmapClip with predefined set of colors, during 1 second each one
    clip = BitmapClip([list(color) for color in input_frames], fps=1).with_duration(
        clip_duration
    )

    # build kwargs passed to `freeze`
    possible_kwargs = {
        "t": t,
        "freeze_duration": freeze_duration,
        "total_duration": total_duration,
        "padding_end": padding_end,
    }
    kwargs = {
        kw_name: kw_value
        for kw_name, kw_value in possible_kwargs.items()
        if kw_value is not None
    }

    # freeze clip
    if hasattr(output_frames, "__traceback__"):
        with pytest.raises(output_frames):
            freeze(clip, **kwargs)
        return
    else:
        freezed_clip = freeze(clip, **kwargs)

    # assert new duration
    expected_freeze_duration = (
        freeze_duration
        if freeze_duration is not None
        else total_duration - clip_duration
    )
    assert freezed_clip.duration == clip_duration + expected_freeze_duration

    # assert colors are the expected
    for i, color in enumerate(freezed_clip.iter_frames()):
        expected_color = list(BitmapClip.DEFAULT_COLOR_DICT[output_frames[i]])
        assert list(color[0][0]) == expected_color

test_freeze(t=None, freeze_duration=1, total_duration=None, padding_end=None, output_frames=['R', 'R', 'G', 'B'])

Selected Statement: freezed_clip = freeze(clip, **kwargs)

Function Input:
t: None
freeze_duration: 1
total_duration: None
padding_end: None
output_frames: R, R, G, B

Variable Values Before Statement:
clip: {color_dict={'R': (255, 0, 0), 'G': (0, 255, 0), 'B': (0, 0, 255), 'O': (0, 0, 0), 'W': (255, 255, 255), 'A': (89, 225, 62), 'C': (113, 157, 108), 'D': (215, 182, 143), 'E': (57, 26, 252), 'F': (225, 135, 33)}, total_frames=3, start=0, end=3, duration=3, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, size=(1, 1), is_mask=False, has_constant_size=True, fps=1}

Value After Statement Execution: {start

Variable States During Runtime (line, value):
t: 1
None
freeze_duration: 1
1
total_duration: 1
None
padding_end: 1
None
output_frames: 1
R, R, G, B
input_frames: 2
R, G, B
clip_duration: 3
3
clip: 6
{color_dict={'R': (255, 0, 0), 'G': (0, 255, 0), 'B': (0, 0, 255), 'O': (0, 0, 0), 'W': (255, 255, 255), 'A': (89, 225, 62), 'C': (113, 157, 108), 'D': (215, 182, 143), 'E': (57, 26, 252), 'F': (225, 135, 33)}, total_frames=3, start=0, end=3, duration=3, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, size=(1, 1), is_mask=False, has_constant_size=True, fps=1}
possible_kwargs: 11
freeze_duration: 1
kwargs: 17
freeze_duration: 1
freezed_clip: 29
{start=0, end=4, duration=4, memoize=False, memoized_t=None, memoized_frame=None, mask=None, audio=None, relative_pos=False, layer=0, size=(1, 1), is_mask=False, has_constant_size=True, timings=array([0, 1, 4]), start_times=array([0, 1]), fps=1}
expected_freeze_duration: 32
1
@py_assert1: 37
None
@py_assert6: 37
None
@py_assert3: 37
None
i: 40
0
40
1
40
2
40
3
color: 40
array([[[255,   0,   0]]])
40
array([[[  0, 255,   0]]])
40
array([[[  0,   0, 255]]])
expected_color: 41
[255, 0, 0]
41
[0, 255, 0]
41
[0, 0, 255]
@py_assert5: 42
None