aiogram/tests/test_utils/test_text_decorations.py
deepsource-autofix[bot] af4ceef153
Format code with black, autopep8 and isort
This commit fixes the style issues introduced in dd50a9b according to the output
from black, autopep8 and isort.

Details: 4e472085-2e87-4f61-b7a1-ed208506962f/
2020-11-08 21:49:34 +00:00

37 lines
1.3 KiB
Python

from aiogram.types import MessageEntity, MessageEntityType
from aiogram.utils import text_decorations
class TestTextDecorations:
def test_unparse_entities_normal_text(self):
if (
text_decorations.markdown_decoration.unparse(
"hi i'm bold and italic and still bold",
entities=[
MessageEntity(offset=3, length=34,
type=MessageEntityType.BOLD),
MessageEntity(offset=12, length=10,
type=MessageEntityType.ITALIC),
],
)
!= "hi *i'm bold _\rand italic_\r and still bold*"
):
raise AssertionError
def test_unparse_entities_emoji_text(self):
"""
emoji is encoded as two chars in json
"""
if (
text_decorations.markdown_decoration.unparse(
"🚀 i'm bold and italic and still bold",
entities=[
MessageEntity(offset=3, length=34,
type=MessageEntityType.BOLD),
MessageEntity(offset=12, length=10,
type=MessageEntityType.ITALIC),
],
)
!= "🚀 *i'm bold _\rand italic_\r and still bold*"
):
raise AssertionError