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:
mpa 2020-05-27 12:22:22 +04:00
parent de3c5c1a8d
commit 32ffda2eb7
No known key found for this signature in database
GPG key ID: BCCFBFCCC9B754A8
6 changed files with 238 additions and 21 deletions

View 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):
...