@@ -461,17 +461,40 @@ def test_blocks_inplace_modification(file_stereo_r):
461461
462462
463463def test_blocks_mono ():
464+ blocks = list (sf .blocks (filename_mono , blocksize = 3 , dtype = 'int16' ))
465+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 ], [- 2 , - 1 ]])
466+
467+
468+ def test_blocks_with_fill_value_mono ():
464469 blocks = list (sf .blocks (filename_mono , blocksize = 3 , dtype = 'int16' ,
465470 fill_value = 0 ))
466471 assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 ], [- 2 , - 1 , 0 ]])
467472
468473
474+ def test_blocks_with_overlap_and_fill_value_mono ():
475+ blocks = list (sf .blocks (filename_mono , blocksize = 4 , dtype = 'int16' ,
476+ overlap = 2 , fill_value = 0 ))
477+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 ], [2 , - 2 , - 1 , 0 ]])
478+
479+
469480def test_block_longer_than_file_with_overlap_mono ():
470481 blocks = list (sf .blocks (filename_mono , blocksize = 20 , dtype = 'int16' ,
471482 overlap = 2 ))
472483 assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 , - 1 ]])
473484
474485
486+ def test_block_longer_than_file_with_fill_value_mono ():
487+ blocks = list (sf .blocks (filename_mono , blocksize = 10 , dtype = 'int16' ,
488+ fill_value = 0 ))
489+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 , - 1 , 0 , 0 , 0 , 0 , 0 ]])
490+
491+
492+ def test_block_longer_than_file_with_overlap_and_fill_value_mono ():
493+ blocks = list (sf .blocks (filename_mono , blocksize = 10 , dtype = 'int16' ,
494+ overlap = 2 , fill_value = 0 ))
495+ assert_equal_list_of_arrays (blocks , [[0 , 1 , 2 , - 2 , - 1 , 0 , 0 , 0 , 0 , 0 ]])
496+
497+
475498def test_blocks_rplus (sf_stereo_rplus ):
476499 blocks = list (sf_stereo_rplus .blocks (blocksize = 2 ))
477500 assert_equal_list_of_arrays (blocks , [data_stereo [0 :2 ], data_stereo [2 :4 ]])
0 commit comments