mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add different shortcut methods for Text.as_kwargs() (#1657)
* Add different shortcut methods for Text.as_kwargs() New methods: - as_caption_kwargs() - as_poll_question_kwargs() - as_poll_explanation_kwargs() - as_gift_text_kwargs() * Add changelog * Fix not passing linter checks
This commit is contained in:
parent
7e8dcc6852
commit
5547963311
3 changed files with 114 additions and 1 deletions
|
|
@ -172,6 +172,34 @@ class TestNode:
|
|||
assert "parse_mode" not in result
|
||||
assert "custom_parse_mode" in result
|
||||
|
||||
def test_as_caption_kwargs(self):
|
||||
node = Text("Hello, ", Bold("World"), "!")
|
||||
result = node.as_caption_kwargs()
|
||||
assert "caption" in result
|
||||
assert "caption_entities" in result
|
||||
assert "parse_mode" in result
|
||||
|
||||
def test_as_poll_question_kwargs(self):
|
||||
node = Text("Hello, ", Bold("World"), "!")
|
||||
result = node.as_poll_question_kwargs()
|
||||
assert "question" in result
|
||||
assert "question_entities" in result
|
||||
assert "question_parse_mode" in result
|
||||
|
||||
def test_as_poll_explanation_kwargs(self):
|
||||
node = Text("Hello, ", Bold("World"), "!")
|
||||
result = node.as_poll_explanation_kwargs()
|
||||
assert "explanation" in result
|
||||
assert "explanation_entities" in result
|
||||
assert "explanation_parse_mode" in result
|
||||
|
||||
def test_as_as_gift_text_kwargs_kwargs(self):
|
||||
node = Text("Hello, ", Bold("World"), "!")
|
||||
result = node.as_gift_text_kwargs()
|
||||
assert "text" in result
|
||||
assert "text_entities" in result
|
||||
assert "text_parse_mode" in result
|
||||
|
||||
def test_as_html(self):
|
||||
node = Text("Hello, ", Bold("World"), "!")
|
||||
assert node.as_html() == "Hello, <b>World</b>!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue