Throttle for two methonds in same class

This commit is contained in:
Per Sandström 2016-02-27 23:18:56 +01:00
parent d6a14a1767
commit 562db5ea4c
2 changed files with 28 additions and 8 deletions

View file

@ -238,3 +238,20 @@ class TestUtil(unittest.TestCase):
self.assertTrue(throttled())
self.assertIsNone(throttled())
def test_throttle_on_two_method(self):
""" Test that throttle works when wrapping two methods. """
class Tester(object):
@util.Throttle(timedelta(seconds=1))
def hello(self):
return True
@util.Throttle(timedelta(seconds=1))
def goodbye(self):
return True
tester = Tester()
self.assertTrue(tester.hello())
self.assertTrue(tester.goodbye())