Exemplo n.º 1
0
 def test_close_callbacks_when_not_enabled(self):
     with open(self.filename) as f:
         chunk = ReadFileChunk(f, chunk_size=1, full_file_size=3,
                               enable_callbacks=False,
                               close_callbacks=[self.close_callback])
         chunk.close()
         self.assertEqual(self.num_close_callback_calls, 0)
 def test_close_callbacks(self):
     with open(self.filename) as f:
         chunk = ReadFileChunk(f,
                               chunk_size=1,
                               full_file_size=3,
                               close_callbacks=[self.close_callback])
         chunk.close()
         self.assertEqual(self.num_close_callback_calls, 1)