mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
* Move packages * Added changelog * Update examples/echo_bot.py Co-authored-by: Oleg A. <t0rr@mail.ru> * Rename `handler` -> `handlers` * Update __init__.py Co-authored-by: Oleg A. <t0rr@mail.ru>
20 lines
719 B
Python
20 lines
719 B
Python
import pytest
|
|
|
|
from aiogram.fsm.strategy import FSMStrategy, apply_strategy
|
|
|
|
|
|
class TestStrategy:
|
|
@pytest.mark.parametrize(
|
|
"strategy,case,expected",
|
|
[
|
|
[FSMStrategy.USER_IN_CHAT, (-42, 42), (-42, 42)],
|
|
[FSMStrategy.CHAT, (-42, 42), (-42, -42)],
|
|
[FSMStrategy.GLOBAL_USER, (-42, 42), (42, 42)],
|
|
[FSMStrategy.USER_IN_CHAT, (42, 42), (42, 42)],
|
|
[FSMStrategy.CHAT, (42, 42), (42, 42)],
|
|
[FSMStrategy.GLOBAL_USER, (42, 42), (42, 42)],
|
|
],
|
|
)
|
|
def test_strategy(self, strategy, case, expected):
|
|
chat_id, user_id = case
|
|
assert apply_strategy(chat_id=chat_id, user_id=user_id, strategy=strategy) == expected
|