1111from unblob .models import UnknownChunk , ValidChunk
1212from unblob .processing import (
1313 ExtractionConfig ,
14- calculate_buffer_size ,
14+ calculate_block_size ,
1515 calculate_entropy ,
1616 calculate_unknown_chunks ,
1717 format_entropy_plot ,
@@ -129,41 +129,45 @@ def test_calculate_unknown_chunks(
129129 (1000 , 100 , 10 , 100 , 10 ),
130130 ],
131131)
132- def test_calculate_buffer_size (
132+ def test_calculate_block_size (
133133 file_size : int , chunk_count : int , min_limit : int , max_limit : int , expected : int
134134):
135- assert expected == calculate_buffer_size (
136- file_size , chunk_count = chunk_count , min_limit = min_limit , max_limit = max_limit
135+ assert expected == calculate_block_size (
136+ file_size ,
137+ chunk_count = chunk_count ,
138+ min_limit = min_limit ,
139+ max_limit = max_limit ,
137140 )
138141
139142
140143def test_format_entropy_plot_error ():
141144 with pytest .raises (TypeError ):
142- format_entropy_plot (percentages = [], buffer_size = 1024 )
145+ format_entropy_plot (percentages = [], block_size = 1024 )
143146
144147
145148@pytest .mark .parametrize (
146- "percentages, buffer_size " ,
149+ "percentages, block_size " ,
147150 [
148151 pytest .param ([0.0 ] * 100 , 1024 , id = "zero-array" ),
149152 pytest .param ([99.99 ] * 100 , 1024 , id = "99-array" ),
150153 pytest .param ([100.0 ] * 100 , 1024 , id = "100-array" ),
151- pytest .param ([100.0 ] * 100 , - 1 , id = "buffer_size -can-be-anything1" ),
152- pytest .param ([100.0 ] * 100 , None , id = "buffer_size -can-be-anything2" ),
153- pytest .param ([100.0 ] * 100 , "None" , id = "buffer_size -can-be-anything3" ),
154+ pytest .param ([100.0 ] * 100 , - 1 , id = "block_size -can-be-anything1" ),
155+ pytest .param ([100.0 ] * 100 , None , id = "block_size -can-be-anything2" ),
156+ pytest .param ([100.0 ] * 100 , "None" , id = "block_size -can-be-anything3" ),
154157 ],
155158)
156- def test_format_entropy_plot_no_exception (percentages : List [float ], buffer_size : int ):
157- assert str (buffer_size ) in format_entropy_plot (
158- percentages = percentages , buffer_size = buffer_size
159+ def test_format_entropy_plot_no_exception (percentages : List [float ], block_size : int ):
160+ assert str (block_size ) in format_entropy_plot (
161+ percentages = percentages ,
162+ block_size = block_size ,
159163 )
160164
161165
162166def test_calculate_entropy_no_exception ():
163167 report = calculate_entropy (Path (sys .executable ))
164168 format_entropy_plot (
165169 percentages = report .percentages ,
166- buffer_size = report .buffer_size ,
170+ block_size = report .block_size ,
167171 )
168172
169173
@@ -375,7 +379,8 @@ def get_all(file_name, report_type: Type[T]) -> List[T]:
375379 [unknown_chunk_report ] = get_all ("input-file" , UnknownChunkReport )
376380 unknown_entropy = unknown_chunk_report .entropy
377381 assert unknown_entropy == EntropyReport (
378- percentages = [0.0 , 75.0 ] + [100.0 ] * 62 , buffer_size = 1024
382+ percentages = [0.0 , 75.0 ] + [100.0 ] * 62 ,
383+ block_size = 1024 ,
379384 )
380385 assert (
381386 unknown_entropy is not None
@@ -386,6 +391,6 @@ def get_all(file_name, report_type: Type[T]) -> List[T]:
386391
387392 # we should have entropy calculated for files without extractions, except for empty files
388393 assert [] == get_all ("empty.txt" , EntropyReport )
389- assert [EntropyReport (percentages = [100.0 ], buffer_size = 1024 )] == get_all (
394+ assert [EntropyReport (percentages = [100.0 ], block_size = 1024 )] == get_all (
390395 "0-255.bin" , EntropyReport
391396 )
0 commit comments