def test_size_formatting(self): self.assertEqual(utils.sizeof_fmt(-1), '-1.0bytes') self.assertEqual(utils.sizeof_fmt(0), '0.0bytes') self.assertEqual(utils.sizeof_fmt(1000000), '976.6KB') self.assertEqual(utils.sizeof_fmt(1000000000000000), '909.5TB')
def handle_download_progress(self, loaded_block_num, block_size, total_size): self.cur_item["progress"] = str( utils.sizeof_fmt(loaded_block_num * block_size)) + "/" + str( utils.sizeof_fmt(total_size))
def handle_download_progress(self, loaded_block_num, block_size, total_size): self.cur_item["progress"] = str(utils.sizeof_fmt(loaded_block_num * block_size)) + "/" + str(utils.sizeof_fmt(total_size))