@@ -42,11 +42,9 @@ def test_ensure_n_jobs():
4242
4343
4444def test_ensure_chunk_size ():
45- recording = generate_recording (num_channels = 2 )
45+ recording = generate_recording (num_channels = 2 , durations = [ 5.0 , 2.5 ]) # This is the default value for two semgents
4646 dtype = recording .get_dtype ()
4747 assert dtype == "float32"
48- # make serializable
49- recording = recording .save ()
5048
5149 chunk_size = ensure_chunk_size (recording , total_memory = "512M" , chunk_size = None , chunk_memory = None , n_jobs = 2 )
5250 assert chunk_size == 32000000
@@ -69,6 +67,15 @@ def test_ensure_chunk_size():
6967 chunk_size = ensure_chunk_size (recording , chunk_duration = "500ms" )
7068 assert chunk_size == 15000
7169
70+ # Test edge case to define single chunk for n_jobs=1
71+ chunk_size = ensure_chunk_size (recording , n_jobs = 1 , chunk_size = None )
72+ chunks = divide_recording_into_chunks (recording , chunk_size )
73+ assert len (chunks ) == recording .get_num_segments ()
74+ for chunk in chunks :
75+ segment_index , start_frame , end_frame = chunk
76+ assert start_frame == 0
77+ assert end_frame == recording .get_num_frames (segment_index = segment_index )
78+
7279
7380def func (segment_index , start_frame , end_frame , worker_ctx ):
7481 import os
0 commit comments