예제 #1
0
    def get_rendered_transfer(self, step=None, steps=None):
        if step is None:
            step = self.step
        if steps is None:
            steps = self.steps

        if steps <= 0:
            return '%s: -' % self.transfer_label
        total = filesizeformat(float(steps))
        if step <= 0:
            transferred = '-'
        else:
            transferred = filesizeformat(float(step))
        return '%s: %s / %s' % (self.transfer_label, transferred, total)
예제 #2
0
    def get_rendered_transfer(self, step=None, steps=None):
        if step is None:
            step = self.step
        if steps is None:
            steps = self.steps

        if steps <= 0:
            return '%s: -' % self.transfer_label
        total = filesizeformat(float(steps))
        if step <= 0:
            transferred = '-'
        else:
            transferred = filesizeformat(float(step))
        return '%s: %s / %s' % (self.transfer_label, transferred, total)
예제 #3
0
 def get_rendered_speed(self, step=None, total_seconds=None):
     if step is None:
         step = self.step
     if total_seconds is None:
         total_seconds = get_total_seconds(self.get_total_time())
     if step <= 0 or total_seconds <= 0:
         speed = '-'
     else:
         speed = filesizeformat(float(step) / total_seconds)
     return '%s: %s/s' % (self.speed_label, speed)
예제 #4
0
 def get_rendered_speed(self, step=None, total_seconds=None):
     if step is None:
         step = self.step
     if total_seconds is None:
         total_seconds = self.get_total_time().total_seconds()
     if step <= 0 or total_seconds <= 0:
         speed = '-'
     else:
         speed = filesizeformat(float(step) / total_seconds)
     return '%s: %s/s' % (self.speed_label, speed)
예제 #5
0
 def test_kilobytes(self):
     self.assertEqual(filesizeformat(1024 * 2), '2 KB')
예제 #6
0
 def test_kilobytes(self):
     assert filesizeformat(1024 * 2) == '2 KB'
예제 #7
0
 def test_bytes(self):
     assert filesizeformat(10) == '10 B'
예제 #8
0
 def test_that_function_respects_sep_parameter(self):
     assert filesizeformat(1, '') == '1B'
예제 #9
0
 def test_gigabytes(self):
     assert filesizeformat(1024 * 1024 * 1024 * 12.92) == '12.92 GB'
예제 #10
0
 def test_megabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 2.3), '2.3 MB')
예제 #11
0
 def test_that_function_respects_sep_paramtere(self):
     self.assertEqual(filesizeformat(1, ''), '1B')
예제 #12
0
 def test_bytes(self):
     self.assertEqual(filesizeformat(10), '10 B')
예제 #13
0
 def test_that_function_respects_sep_paramtere(self):
     self.assertEqual(filesizeformat(1, ''), '1B')
예제 #14
0
 def test_gigabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 1024 * 12.92),
                      '12.92 GB')
예제 #15
0
 def test_megabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 2.3), '2.3 MB')
예제 #16
0
 def test_gigabytes(self):
     self.assertEqual(filesizeformat(1024 * 1024 * 1024 * 12.92), '12.92 GB')
예제 #17
0
 def test_megabytes(self):
     assert filesizeformat(1024 * 1024 * 2.3) == '2.3 MB'
예제 #18
0
 def test_bytes(self):
     self.assertEqual(filesizeformat(10), '10 B')
예제 #19
0
 def test_kilobytes(self):
     self.assertEqual(filesizeformat(1024 * 2), '2 KB')