mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
Add middlewares (API + Docs + Tests)
This commit is contained in:
parent
e4cd4c1763
commit
5b6ec599b1
24 changed files with 1120 additions and 42 deletions
|
|
@ -2,37 +2,54 @@ from typing import Any, Callable, Optional, Tuple
|
|||
|
||||
import pytest
|
||||
|
||||
from aiogram.utils import markdown
|
||||
from aiogram.utils.markdown import (
|
||||
bold,
|
||||
code,
|
||||
hbold,
|
||||
hcode,
|
||||
hide_link,
|
||||
hitalic,
|
||||
hlink,
|
||||
hpre,
|
||||
hstrikethrough,
|
||||
hunderline,
|
||||
italic,
|
||||
link,
|
||||
pre,
|
||||
strikethrough,
|
||||
text,
|
||||
underline,
|
||||
)
|
||||
|
||||
|
||||
class TestMarkdown:
|
||||
@pytest.mark.parametrize(
|
||||
"func,args,sep,result",
|
||||
[
|
||||
[markdown.text, ("test", "test"), " ", "test test"],
|
||||
[markdown.text, ("test", "test"), "\n", "test\ntest"],
|
||||
[markdown.text, ("test", "test"), None, "test test"],
|
||||
[markdown.bold, ("test", "test"), " ", "*test test*"],
|
||||
[markdown.hbold, ("test", "test"), " ", "<b>test test</b>"],
|
||||
[markdown.italic, ("test", "test"), " ", "_test test_\r"],
|
||||
[markdown.hitalic, ("test", "test"), " ", "<i>test test</i>"],
|
||||
[markdown.code, ("test", "test"), " ", "`test test`"],
|
||||
[markdown.hcode, ("test", "test"), " ", "<code>test test</code>"],
|
||||
[markdown.pre, ("test", "test"), " ", "```test test```"],
|
||||
[markdown.hpre, ("test", "test"), " ", "<pre>test test</pre>"],
|
||||
[markdown.underline, ("test", "test"), " ", "__test test__"],
|
||||
[markdown.hunderline, ("test", "test"), " ", "<u>test test</u>"],
|
||||
[markdown.strikethrough, ("test", "test"), " ", "~test test~"],
|
||||
[markdown.hstrikethrough, ("test", "test"), " ", "<s>test test</s>"],
|
||||
[markdown.link, ("test", "https://aiogram.dev"), None, "[test](https://aiogram.dev)"],
|
||||
[text, ("test", "test"), " ", "test test"],
|
||||
[text, ("test", "test"), "\n", "test\ntest"],
|
||||
[text, ("test", "test"), None, "test test"],
|
||||
[bold, ("test", "test"), " ", "*test test*"],
|
||||
[hbold, ("test", "test"), " ", "<b>test test</b>"],
|
||||
[italic, ("test", "test"), " ", "_test test_\r"],
|
||||
[hitalic, ("test", "test"), " ", "<i>test test</i>"],
|
||||
[code, ("test", "test"), " ", "`test test`"],
|
||||
[hcode, ("test", "test"), " ", "<code>test test</code>"],
|
||||
[pre, ("test", "test"), " ", "```test test```"],
|
||||
[hpre, ("test", "test"), " ", "<pre>test test</pre>"],
|
||||
[underline, ("test", "test"), " ", "__test test__"],
|
||||
[hunderline, ("test", "test"), " ", "<u>test test</u>"],
|
||||
[strikethrough, ("test", "test"), " ", "~test test~"],
|
||||
[hstrikethrough, ("test", "test"), " ", "<s>test test</s>"],
|
||||
[link, ("test", "https://aiogram.dev"), None, "[test](https://aiogram.dev)"],
|
||||
[
|
||||
markdown.hlink,
|
||||
hlink,
|
||||
("test", "https://aiogram.dev"),
|
||||
None,
|
||||
'<a href="https://aiogram.dev">test</a>',
|
||||
],
|
||||
[
|
||||
markdown.hide_link,
|
||||
hide_link,
|
||||
("https://aiogram.dev",),
|
||||
None,
|
||||
'<a href="https://aiogram.dev">​</a>',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue