def test_application_weakref(self, bot):
     jq = JobQueue()
     application = ApplicationBuilder().token(
         bot.token).job_queue(None).build()
     with pytest.raises(RuntimeError, match="No application was set"):
         jq.application
     jq.set_application(application)
     assert jq.application is application
     del application
     with pytest.raises(RuntimeError, match="no longer alive"):
         jq.application
async def job_queue(bot, app):
    jq = JobQueue()
    jq.set_application(app)
    await jq.start()
    yield jq
    await jq.stop()