mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
✨ Add sentinel value for parse_mode which can be None itself
Resolves #302. We decided to use sentinel pattern (https://python-patterns.guide/python/sentinel-object/) as a solution, but got a few problems with plain `object()`, so instead we use unittest.mock.sentinel and we hope it won't cause side effects. Most of work done via tg-codegen (https://github.com/aiogram/tg-codegen/pull/1), so it's good to review only implementation of sentinel, processing sentinel in `prepare_parse_mode`, changes in base method model and little test fixes.
This commit is contained in:
parent
9f00a02e4d
commit
023245c76b
34 changed files with 108 additions and 53 deletions
|
|
@ -59,4 +59,4 @@ class TestPrepareParseMode:
|
|||
def test_bot_not_in_context(self):
|
||||
data = {}
|
||||
prepare_parse_mode(data)
|
||||
assert "parse_mode" not in data
|
||||
assert data["parse_mode"] is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue