def test_add_end_buffer__one_entry_returns_one_chunk(): x = [ Chunk(size=1, is_silence=False), ] mask = [True] res = add_end_buffer(x, mask, 1) assert [ Chunk(size=1, is_silence=False), ] == res
def test_add_end_buffer__first_entry__adds_buffer(): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), ] mask = [True, False] res = add_end_buffer(x, mask, 1) assert [ Chunk(size=2, is_silence=False), Chunk(size=1, is_silence=False), ] == res
def test_add_end_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_end_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_end_buffer__first_entry_too_much_add__adds_buffer_and_not_subtracts_on_second_next_buffer( ): x = [ Chunk(size=1, is_silence=False), Chunk(size=2, is_silence=False), Chunk(size=3, is_silence=False), ] mask = [True, False, False] res = add_end_buffer(x, mask, 10) assert [ Chunk(size=3, is_silence=False), Chunk(size=0, is_silence=False), Chunk(size=3, is_silence=False), ] == res
def test_add_end_buffer__empty_list_returns_empty_list(): res = add_end_buffer([], [], 1) assert [] == res