def test_tb(self): self.assertEqual(format_bytes(1024**4), '1.0TB') self.assertEqual(format_bytes(1024**4 + (1024**4 / 2)), '1.5TB')
def test_gb(self): self.assertEqual(format_bytes(1024**3), '1.0GB') self.assertEqual(format_bytes(1024**3 + (1024**3 / 2)), '1.5GB')
def test_kb(self): self.assertEqual(format_bytes(1024), '1.0KB') self.assertEqual(format_bytes(1024 + 512), '1.5KB')
def test_mb(self): self.assertEqual(format_bytes(1024**2), '1.0MB') self.assertEqual(format_bytes(1024**2 + (1024**2 / 2)), '1.5MB')
def test_b(self): self.assertEqual(format_bytes(0), '0B') self.assertEqual(format_bytes(1000), '1000B')