Accept `datetime.timedelta` Input in `Bot` Method Parameters by Bibo-Joshi · Pull Request #4651 · python-telegram-bot/python-telegram-bot
self = <tests.test_bot.TestBotWithRequest object at 0x000001CB66A25ED0> tz_bot = PytestExtBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To] super_group_id = '-1001279600026' async def test_send_close_date_default_tz(self, tz_bot, super_group_id): question = "Is this a test?" answers = ["Yes", "No", "Maybe"] reply_markup = InlineKeyboardMarkup.from_button( InlineKeyboardButton(text="text", callback_data="data") ) aware_close_date = dtm.datetime.now(tz=tz_bot.defaults.tzinfo) + dtm.timedelta(seconds=5) close_date = aware_close_date.replace(tzinfo=None) msg = await tz_bot.send_poll( # The timezone returned from this is always converted to UTC chat_id=super_group_id, question=question, options=answers, close_date=close_date, read_timeout=60, ) msg.poll._unfreeze() # Sometimes there can be a few seconds delay, so don't let the test fail due to that- > msg.poll.close_date = msg.poll.close_date.astimezone(aware_close_date.tzinfo) E AttributeError: 'NoneType' object has no attribute 'astimezone' tests\test_bot.py:2775: AttributeError