def test_MakeHumanReadable(self): self.assertEqual(util.MakeHumanReadable(0), '0 B') self.assertEqual(util.MakeHumanReadable(1023), '1023 B') self.assertEqual(util.MakeHumanReadable(1024), '1 KB') self.assertEqual(util.MakeHumanReadable(1024**2), '1 MB') self.assertEqual(util.MakeHumanReadable(1024**3), '1 GB') self.assertEqual(util.MakeHumanReadable(1024**3 * 5.3), '5.3 GB') self.assertEqual(util.MakeHumanReadable(1024**4 * 2.7), '2.7 TB') self.assertEqual(util.MakeHumanReadable(1024**5), '1 PB') self.assertEqual(util.MakeHumanReadable(1024**6), '1 EB')
def test_MakeHumanReadable(self): """Tests converting byte counts to human-readable strings.""" self.assertEqual(util.MakeHumanReadable(0), '0 B') self.assertEqual(util.MakeHumanReadable(1023), '1023 B') self.assertEqual(util.MakeHumanReadable(1024), '1 KB') self.assertEqual(util.MakeHumanReadable(1024**2), '1 MB') self.assertEqual(util.MakeHumanReadable(1024**3), '1 GB') self.assertEqual(util.MakeHumanReadable(1024**3 * 5.3), '5.3 GB') self.assertEqual(util.MakeHumanReadable(1024**4 * 2.7), '2.7 TB') self.assertEqual(util.MakeHumanReadable(1024**5), '1 PB') self.assertEqual(util.MakeHumanReadable(1024**6), '1 EB')