def data_generator(self, first_block_of_data, first_block_is_entire_file=False): if len(first_block_of_data) < 128: return [] if classify_header(first_block_of_data[:3]) is None: return [] return [ reader_from_file_like_object_accepting_function( self._mp3_data_processor), reader_from_trailing_block_accepting_function( self._id3v1tagreader, 128) ]
def build_reader(self): called = [] def func(block): if called: self.fail("Block accepting function called more than once") called.append(True) self.assertEqual(self.expected_block, block) def is_called(): return bool(called) return reader_from_trailing_block_accepting_function( func, len(self.expected_block)), is_called