Tests coverage

This commit is contained in:
Alex Root Junior 2023-08-13 17:16:01 +03:00
parent bc550382b8
commit e0a4bc8f8b
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC
2 changed files with 10 additions and 0 deletions

View file

@ -74,6 +74,8 @@ class TextDecoration(ABC):
if entity.type == MessageEntityType.CUSTOM_EMOJI:
return self.custom_emoji(value=text, custom_emoji_id=cast(str, entity.custom_emoji_id))
# This case is not possible because of `if` above, but if any new entity is added to
# API it will be here too
return self.quote(text)
def unparse(self, text: str, entities: Optional[List[MessageEntity]] = None) -> str:

View file

@ -113,6 +113,14 @@ class TestTextDecoration:
):
assert decorator.apply_entity(entity, "test") == result
def test_unknown_apply_entity(self):
assert (
html_decoration.apply_entity(
MessageEntity(type="unknown", offset=0, length=5), "<test>"
)
== "&lt;test&gt;"
)
@pytest.mark.parametrize(
"decorator,before,after",
[