'Testing whether the right byte progress is returned in LibtorrentDownloadImpl'

def test_get_byte_progress(self):

    self.assertEqual(self.libtorrent_download_impl.get_byte_progress([((-1), 0, 0)], False), 1.0)
    def map_file(_dummy1, start_byte, _dummy2):
        res = MockObject()
        res.piece = int((start_byte / 250))
        return res
    self.libtorrent_download_impl.handle.get_torrent_info().num_pieces = (lambda : 4)
    self.libtorrent_download_impl.handle.get_torrent_info().map_file = map_file
    self.assertEqual(self.libtorrent_download_impl.get_byte_progress([(0, 10, 270)], True), 0.5)
