示例#1
0
文件: test_util.py 项目: jkff/gsutil
 def test_MakeBitsHumanReadable(self):
     self.assertEqual(util.MakeBitsHumanReadable(0), '0 bit')
     self.assertEqual(util.MakeBitsHumanReadable(1023), '1023 bit')
     self.assertEqual(util.MakeBitsHumanReadable(1024), '1 Kbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**2), '1 Mbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**3), '1 Gbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**3 * 5.3), '5.3 Gbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**4 * 2.7), '2.7 Tbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**5), '1 Pbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**6), '1 Ebit')
示例#2
0
 def test_MakeBitsHumanReadable(self):
     """Tests converting bit counts to human-readable strings."""
     self.assertEqual(util.MakeBitsHumanReadable(0), '0 bit')
     self.assertEqual(util.MakeBitsHumanReadable(1023), '1023 bit')
     self.assertEqual(util.MakeBitsHumanReadable(1024), '1 Kbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**2), '1 Mbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**3), '1 Gbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**3 * 5.3), '5.3 Gbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**4 * 2.7), '2.7 Tbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**5), '1 Pbit')
     self.assertEqual(util.MakeBitsHumanReadable(1024**6), '1 Ebit')