def test_add_start_buffer__one_entry_returns_one_chunk(): x = [ Chunk(size=1, is_silence=False), ] mask = [True] res = add_start_buffer(x, mask, 1) assert [ Chunk(size=1, is_silence=False), ] == res
def test_add_start_buffer__last_entry_too_much_add__adds_buffer(): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), ] mask = [False, True] res = add_start_buffer(x, mask, 10) assert [ Chunk(size=0, is_silence=False), Chunk(size=3, is_silence=False), ] == res
def test_add_start_buffer__first_entry__adds_no_buffer(): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), ] mask = [True, False] res = add_start_buffer(x, mask, 1) assert [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), ] == res
def test_add_start_buffer__all_false__adds_no_buffer(): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), Chunk(size=3, is_silence=False), ] mask = [False, False, False] res = add_start_buffer(x, mask, 1) assert [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), Chunk(size=3, is_silence=False), ] == res
def test_add_start_buffer__middle_entry__adds_buffer(): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), Chunk(size=3, is_silence=False), ] mask = [False, True, False] res = add_start_buffer(x, mask, 1) assert [ Chunk(size=0, is_silence=False), Chunk(size=3, is_silence=False), Chunk(size=3, is_silence=False), ] == res
def test_add_start_buffer__last_entry_too_much_add__adds_buffer_and_not_subtracts_on_second_previous_buffer( ): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), Chunk(size=3, is_silence=False), ] mask = [False, False, True] res = add_start_buffer(x, mask, 10) assert [ Chunk(size=1, is_silence=False), Chunk(size=0, is_silence=False), Chunk(size=5, is_silence=False), ] == res
def test_add_start_buffer__empty_list_returns_empty_list(): res = add_start_buffer([], [], 1) assert [] == res