aiogram-tests-1.0.3


توضیحات

A library for testing your bots on aiogram
ویژگی مقدار
سیستم عامل OS Independent
نام فایل aiogram-tests-1.0.3
نام aiogram-tests
نسخه کتابخانه 1.0.3
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده Timur <pavlov.timur556@yandex.ru>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/aiogram-tests/
مجوز -
# Aiogram Tests ***aiogram_tests*** is a testing library for bots written on <a href="https://github.com/aiogram/aiogram">aiogram</a> ## 📚 Simple examples ### Simple handler test #### Simple bot: ```python from aiogram import Bot, Dispatcher, types from aiogram.fsm.context import FSMContext # Please, keep your bot tokens on environments, this code only example bot = Bot('123456789:AABBCCDDEEFFaabbccddeeff-1234567890') dp = Dispatcher() @dp.message() async def echo(message: types.Message, state: FSMContext) -> None: await message.answer(message.text) if __name__ == '__main__': dp.run_polling(bot) ``` #### Test cases: ```python import pytest from bot import echo from aiogram_tests import MockedBot from aiogram_tests.handler import MessageHandler from aiogram_tests.types.dataset import MESSAGE @pytest.mark.asyncio async def test_echo(): request = MockedBot(MessageHandler(echo)) calls = await request.query(message=MESSAGE.as_object(text="Hello, Bot!")) answer_message = calls.send_messsage.fetchone() assert answer_message.text == "Hello, Bot!" ``` ### ▶️ <a href='https://github.com/aiogram-tests/aiogram_tests/tree/master/examples'>More</a> examples


نحوه نصب


نصب پکیج whl aiogram-tests-1.0.3:

    pip install aiogram-tests-1.0.3.whl


نصب پکیج tar.gz aiogram-tests-1.0.3:

    pip install aiogram-tests-1.0.3.tar.gz