async def async_current_transfer_human_readable(self, use_cache=True): """Gets current transfer rates in a human readable format.""" rx, tx = await self.async_get_current_transfer_rates(use_cache) return "%s/s" % convert_size(rx), "%s/s" % convert_size(tx)
def test_convert_size(): assert "0 B" == convert_size(0) assert "1.0 B" == convert_size(1) assert "1.0 KB" == convert_size(1024) assert "1.0 MB" == convert_size(1024 * 1024) assert "1.0 GB" == convert_size(1024 * 1024 * 1024)