Fix throttle to work on instance-level

This commit is contained in:
Paulus Schoutsen 2015-10-08 23:49:55 -07:00
parent 8a04e1f5f4
commit 47fc1deecb
2 changed files with 30 additions and 12 deletions

View file

@ -218,3 +218,14 @@ class TestUtil(unittest.TestCase):
self.assertEqual(3, len(calls1))
self.assertEqual(2, len(calls2))
def test_throttle_per_instance(self):
""" Test that the throttle method is done per instance of a class. """
class Tester(object):
@util.Throttle(timedelta(seconds=1))
def hello(self):
return True
self.assertTrue(Tester().hello())
self.assertTrue(Tester().hello())