Exemple #1
0
 def create_stats(self, disk: dict) -> str:
     """
     Creates statistics as string for a disk
     
     Args:
         disk (dict): stats to print
     """
     r = ints_to_human_readable(disk)
     return f"Total: {r['total']}\t Used: {r['used']}\t Free: {r['free']}"
Exemple #2
0
 def test_ints_to_human_readable(self):
     for i in range(20):
         test_dict = {
             'mb': random.randint(1048576, 943718400),
             'gb': random.randint(1073741824, 549755813888),
             'bs': random.randint(1, 1024),
             'String': 'This is text'
         }
         result = ints_to_human_readable(test_dict)
         self.assertEqual(result['mb'].split(' ')[1], 'MB')
         self.assertEqual(result['gb'].split(' ')[1], 'GB')
         self.assertEqual(result['bs'].split(' ')[1], 'B')
         self.assertEqual(result['String'], 'This is text')
Exemple #3
0
 def create_stats(self, disk: dict) -> str:
     r = tools.ints_to_human_readable(disk)
     return f"Total: {r['total']}\t Used: {r['used']}\t Free: {r['free']}"