mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-26 00:56:22 +01:00
more tests
This commit is contained in:
parent
24b2bf335c
commit
73f4f26da5
1 changed files with 20 additions and 0 deletions
|
@ -72,6 +72,9 @@ class UpdaterTest(BaseTest, unittest.TestCase):
|
|||
def job1(self, bot):
|
||||
self.result += 1
|
||||
|
||||
def job2(self, bot):
|
||||
raise Exception("Test Error")
|
||||
|
||||
def test_basic(self):
|
||||
print('Testing basic job queue function')
|
||||
self.jq.put(self.job1, 0.1)
|
||||
|
@ -95,5 +98,22 @@ class UpdaterTest(BaseTest, unittest.TestCase):
|
|||
sleep(0.1)
|
||||
self.assertEqual(1, self.result)
|
||||
|
||||
def test_multiple(self):
|
||||
print('Testing job queue with multiple jobs')
|
||||
self.jq.put(self.job1, 0.1, repeat=False)
|
||||
self.jq.put(self.job1, 0.2, repeat=False)
|
||||
self.jq.put(self.job1, 0.4)
|
||||
self.jq.start()
|
||||
sleep(1)
|
||||
self.assertEqual(4, self.result)
|
||||
|
||||
def test_error(self):
|
||||
print('Testing job queue starting twice with an erroneous job')
|
||||
self.jq.put(self.job2, 0.1)
|
||||
self.jq.put(self.job1, 0.2)
|
||||
self.jq.start()
|
||||
self.jq.start()
|
||||
sleep(0.4)
|
||||
self.assertEqual(1, self.result)
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue