Examples

Here are some small examples to show how a developer can use PTBtest to write unit tests for a python-telegram-bot bot.

All examples are licensed under the CC0 License and are therefore fully dedicated to the public domain. You can use them as the base for your own bots without worrying about copyrights.

Contents

test_echobot.py

This is the base example of how to use PTBtest to write unit tests for your python-telegram-bot. It is based on echobot which simply replies to each text message with a message that contains the same text.

test_timerbot.py

This example follows the timerbot example at: timerbot. We will skip the start and help handlers and focus on the timer.

test_conversationbot2.py

test_inlinebot.py

test_inlinekeyboard.py