mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Create some tests
This commit is contained in:
parent
6cf06bd081
commit
cabb10bc06
2 changed files with 36 additions and 0 deletions
18
tests/test_dispatcher/test_filters/test_builtin.py
Normal file
18
tests/test_dispatcher/test_filters/test_builtin.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from aiogram.dispatcher.filters.builtin import Text
|
||||||
|
|
||||||
|
|
||||||
|
class TestText:
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('param, key', [
|
||||||
|
('text', 'equals'),
|
||||||
|
('text_contains', 'contains'),
|
||||||
|
('text_startswith', 'startswith'),
|
||||||
|
('text_endswith', 'endswith'),
|
||||||
|
])
|
||||||
|
def test_validate(self, param, key):
|
||||||
|
value = 'spam and eggs'
|
||||||
|
config = {param: value}
|
||||||
|
res = Text.validate(config)
|
||||||
|
assert res == {key: value}
|
||||||
18
tests/test_dispatcher/test_filters/test_state.py
Normal file
18
tests/test_dispatcher/test_filters/test_state.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
from aiogram.dispatcher.filters.state import StatesGroup
|
||||||
|
|
||||||
|
class TestStatesGroup:
|
||||||
|
|
||||||
|
def test_all_childs(self):
|
||||||
|
|
||||||
|
class InnerState1(StatesGroup):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class InnerState2(InnerState1):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Form(StatesGroup):
|
||||||
|
inner1 = InnerState1
|
||||||
|
inner2 = InnerState2
|
||||||
|
|
||||||
|
form_childs = Form.all_childs
|
||||||
|
assert form_childs == (InnerState1, InnerState2)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue