Source code for thriftworker.tests.utilities.stats.test_timer

from __future__ import absolute_import

from thriftworker.tests.utils import TestCase
from thriftworker.utils.stats import Timer


[docs]class TestTimer(TestCase):
[docs] def setUp(self): super(TestTimer, self).setUp() self.timer = Timer()
[docs] def test_add(self): self.timer.add(1.0) self.assertEqual(1, int(self.timer)) self.timer.add(1.0) self.assertEqual(2, int(self.timer))
[docs] def test_add_sample(self): self.timer.add(5) self.assertEqual(5, int(self.timer))
[docs] def test_iadd(self): self.timer += 1 self.assertEqual(1, int(self.timer))
[docs] def test_count(self): self.timer.add(1.0) self.timer.add(1.0) self.assertEqual(2, len(self.timer))
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.