Ejemplo n.º 1
0
    def testTimer(self):
        t = net.Timer()
        self.assertEqual(t.elapsed(), 0)
        self.assertEqual(t.startCount(), 0)
        self.assertEqual(str(t), "[Elapsed: 0 Starts: 0]")
        t.start()

        time.sleep(1)

        t.stop()
        self.assertTrue(t.elapsed() > 0)
        self.assertEqual(t.startCount(), 1)
Ejemplo n.º 2
0
 def testTimer(self):
   t = net.Timer()
   self.assertEqual(t.elapsed, 0)
   self.assertEqual(t.startCount, 0)
   self.assertEqual(str(t), "[Elapsed: 0 Starts: 0]")
   t.start()
   # Dummy time
   _j = 0
   for i in xrange(0, 1000):
     _j = i
   t.stop()
   self.assertTrue(t.elapsed > 0)
   self.assertEqual(t.startCount, 1)