Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import unittest
2from pi3bar.utils import humanize_size_bytes
5class HumanizeSizeBytesTestCase(unittest.TestCase):
6 def test_bytes(self):
7 s = humanize_size_bytes(512.0)
8 self.assertEqual(s, '512.0bytes')
10 def test_kb(self):
11 s = humanize_size_bytes(524288)
12 self.assertEqual(s, '512.0KB')
14 def test_mb(self):
15 s = humanize_size_bytes(536870912)
16 self.assertEqual(s, '512.0MB')
18 def test_gb(self):
19 s = humanize_size_bytes(549755813888)
20 self.assertEqual(s, '512.0GB')
22 def test_tb(self):
23 s = humanize_size_bytes(562949953421312)
24 self.assertEqual(s, '512.0TB')
26 def test_tb_greater_1024(self):
27 s = humanize_size_bytes(1470047046336512)
28 self.assertEqual(s, '1337.0TB')