mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
feat(handler): requirement class
implement POC of "smart defaults", pin newest pydantic 1.5.1 (resolves issue with BaseFilter signature inspection)
This commit is contained in:
parent
de3c5c1a8d
commit
32ffda2eb7
6 changed files with 238 additions and 21 deletions
17
tests/test_dispatcher/test_requirement.py
Normal file
17
tests/test_dispatcher/test_requirement.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# todo
|
||||
from aiogram.dispatcher.requirement import require, CallableRequirement
|
||||
|
||||
tick_data = {"ticks": 0}
|
||||
|
||||
|
||||
def test_require():
|
||||
x = require(lambda: "str", use_cache=True, cache_key=0)
|
||||
assert isinstance(x, CallableRequirement)
|
||||
assert callable(x) & callable(x.callable)
|
||||
assert x.cache_key == 0
|
||||
assert x.use_cache
|
||||
|
||||
|
||||
class TestCallableRequirementCache:
|
||||
def test_cache(self):
|
||||
...
|
||||
Loading…
Add table
Add a link
Reference in a new issue