@@ -403,17 +403,40 @@ def test_blocks_inplace_modification(file_stereo_r):
403403
404404
405405def test_blocks_mono ():
406+ blocks = list (sf .blocks (filename_mono , blocksize = 3 , dtype = 'int16' ))
407+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 ], [- 2 , - 1 ]])
408+
409+
410+ def test_blocks_with_fill_value_mono ():
406411 blocks = list (sf .blocks (filename_mono , blocksize = 3 , dtype = 'int16' ,
407412 fill_value = 0 ))
408413 assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 ], [- 2 , - 1 , 0 ]])
409414
410415
416+ def test_blocks_with_overlap_and_fill_value_mono ():
417+ blocks = list (sf .blocks (filename_mono , blocksize = 4 , dtype = 'int16' ,
418+ overlap = 2 , fill_value = 0 ))
419+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 ], [2 , - 2 , - 1 , 0 ]])
420+
421+
411422def test_block_longer_than_file_with_overlap_mono ():
412423 blocks = list (sf .blocks (filename_mono , blocksize = 20 , dtype = 'int16' ,
413424 overlap = 2 ))
414425 assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 , - 1 ]])
415426
416427
428+ def test_block_longer_than_file_with_fill_value_mono ():
429+ blocks = list (sf .blocks (filename_mono , blocksize = 10 , dtype = 'int16' ,
430+ fill_value = 0 ))
431+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 , - 1 , 0 , 0 , 0 , 0 , 0 ]])
432+
433+
434+ def test_block_longer_than_file_with_overlap_and_fill_value_mono ():
435+ blocks = list (sf .blocks (filename_mono , blocksize = 10 , dtype = 'int16' ,
436+ overlap = 2 , fill_value = 0 ))
437+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 , - 1 , 0 , 0 , 0 , 0 , 0 ]])
438+
439+
417440def test_blocks_rplus (sf_stereo_rplus ):
418441 blocks = list (sf_stereo_rplus .blocks (blocksize = 2 ))
419442 assert_equal_list_of_arrays (blocks , [data_stereo [0 :2 ], data_stereo [2 :4 ]])
0 commit comments