示例#1
0
    def test_continuation(self):
        q = Quota(1)

        q._start()
        q._stop()
        time.sleep(0.2)
        q._start()
        q._stop()

        # tolerate a little time spent outside the sleep:
        self.assertGreater(q.remaining(), 0.9)
示例#2
0
    def test_continuation(self):
        q = Quota(1)

        q._start()
        q._stop()
        time.sleep(0.2)
        q._start()
        q._stop()

        # tolerate a little time spent outside the sleep:
        self.assertGreater(q.remaining(), 0.9)
示例#3
0
    def test_remaining(self):
        q = Quota(1)
        self.assertEquals(1, q.remaining())

        q._start()
        self.assertTrue(q.running())
        time.sleep(0.5)
        q._stop()

        self.assertFalse(q.running())
        self.assertLessEqual(q.remaining(), 0.5)
示例#4
0
    def test_remaining(self):
        q = Quota(1)
        self.assertEquals(1, q.remaining())

        q._start()
        self.assertTrue(q.running())
        time.sleep(0.5)
        q._stop()

        self.assertFalse(q.running())
        self.assertLessEqual(q.remaining(), 0.5)