summaryrefslogtreecommitdiff
path: root/tests/helper_test.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-01-27 15:39:28 -0800
committerDylan Baker <dylan@pnwbakers.com>2017-01-27 15:49:26 -0800
commit9c552c58299a7e11cf1bcf5c6eb6a0c81aa16c09 (patch)
tree0ef6d88e07ed3a9d5dc36983e6112fe246e950a3 /tests/helper_test.py
parent9d0a67842e5a9c85f08d619d60360cb90255b6a5 (diff)
helper: Use kibi and mibibytes instead of kilo and megabytes
Technically a kilobyte (and it's derivatives like megabytes and gigabytes) are defined as powers of 1000, while a kibibyte (and it's derivatives like mibibytes and gibibytes) are defined as powers of 1024. This patch fixes incorrect language and formatting in the humanize_size function which defined a kilobyte as 1024. See this wikipedia article for more information: https://en.wikipedia.org/wiki/Kibibyte
Diffstat (limited to 'tests/helper_test.py')
-rw-r--r--tests/helper_test.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/helper_test.py b/tests/helper_test.py
index 90ce0fca..4a97bb7e 100644
--- a/tests/helper_test.py
+++ b/tests/helper_test.py
@@ -80,23 +80,23 @@ class TestHumanizeSize(unittest.TestCase):
readable = helper.humanize_size(1023)
self.assertEqual(readable, "1023")
readable = helper.humanize_size(1024)
- self.assertEqual(readable, "1K")
+ self.assertEqual(readable, "1KiB")
readable = helper.humanize_size(1234)
- self.assertEqual(readable, "1K")
+ self.assertEqual(readable, "1KiB")
def test_numbers_above_1048576_are_converted_to_megabyte(self):
readable = helper.humanize_size(1024*1024-1)
- self.assertEqual(readable, "1023K")
+ self.assertEqual(readable, "1023KiB")
readable = helper.humanize_size(1024*1024)
- self.assertEqual(readable, "1.0M")
+ self.assertEqual(readable, "1.0MiB")
def test_megabyte_numbers_are_converted_with_precision_1(self):
readable = helper.humanize_size(1234*1024)
- self.assertEqual(readable, "1.2M")
+ self.assertEqual(readable, "1.2MiB")
def test_numbers_are_not_converted_to_gigabyte(self):
readable = helper.humanize_size(1234*1024*1024)
- self.assertEqual(readable, "1234.0M")
+ self.assertEqual(readable, "1234.0MiB")
class TestSplitCommandline(unittest.TestCase):