Ejemplo n.º 1
0
    def test_edges(self):
        s = Stats('[%s/%f/%t/%r/%p]', None, None)
        self.assertEqual(s.format(), '[0/0/0/0/ --- ]')
        s.started = 3
        s.total = 5
        s.finished = 1
        self.assertEqual(s.format(), '[3/1/5/2/ 60.0]')

        s.started = 5
        s.finished = 5
        self.assertEqual(s.format(), '[5/5/5/0/100.0]')
Ejemplo n.º 2
0
 def test_overall_rate(self):
     times = [0, 5]
     s = Stats('[%o]', lambda: times.pop(0), 0)
     self.assertEqual(s.format(), '[ --- ]')
     s.started = 3
     s.finished = 1
     s.total = 5
     self.assertEqual(s.format(), '[  0.2]')