class TaskBot(): if __name__ == '__main__': last_update_id = None task = HandleTask() while True: print('Updates') print(last_update_id) updates = task.get_updates(last_update_id) if len(updates['result']) > 0: last_update_id = task.get_last_update_id(updates) + 1 task.handle_updates(updates) time.sleep(0.5)
def main(): last_update_id = None mytask = HandleTask() while True: print("Updates") updates = mytask.get_updates(last_update_id) if len(updates["result"]) > 0: last_update_id = mytask.get_last_update_id(updates) + 1 mytask.handle_updates(updates) time.sleep(0.5)
#!/usr/bin/env python3 import time from handletask import HandleTask if __name__ == '__main__': last_update_id = None task = HandleTask() while True: print('Updates') updates = task.get_updates(last_update_id) if len(updates['result']) > 0: last_update_id = task.get_last_update_id(updates) + 1 task.handle_updates(updates) time.sleep(0.5)
def test_date_format_assert_false(self): date = '30/30/30' value = HandleTask.date_format(self, date) self.assertFalse(value)
def test_get_id_list_returns_list(self): msg = '1 2 3 4 5' value = HandleTask.get_id_list(self, msg) self.assertIsInstance(value, list)
def test_date_format_assert_true(self): date = '10/05/2010' value = HandleTask.date_format(self, date) self.assertTrue(value)
def test_task_condition(): a = HandleTask() assert a.task_condition('DOING', 'DOING') == True