mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-23 15:27:45 +00:00
Fix HTML unparsing when there's no entities
This commit is contained in:
parent
86515bb9d1
commit
217bcb1dfb
@ -233,6 +233,7 @@ class HTML:
|
|||||||
while i < len(entities):
|
while i < len(entities):
|
||||||
i += recursive(i)
|
i += recursive(i)
|
||||||
|
|
||||||
|
if entities_offsets:
|
||||||
last_offset = entities_offsets[-1][1]
|
last_offset = entities_offsets[-1][1]
|
||||||
# no need to sort, but still add entities starting from the end
|
# no need to sort, but still add entities starting from the end
|
||||||
for entity, offset in reversed(entities_offsets):
|
for entity, offset in reversed(entities_offsets):
|
||||||
|
@ -137,3 +137,11 @@ def test_html_unparse_escaped_nested():
|
|||||||
pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=8, length=16)])
|
pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=8, length=16)])
|
||||||
|
|
||||||
assert HTML.unparse(text=text, entities=entities) == expected
|
assert HTML.unparse(text=text, entities=entities) == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_html_unparse_no_entities():
|
||||||
|
expected = "text"
|
||||||
|
text = "text"
|
||||||
|
entities = []
|
||||||
|
|
||||||
|
assert HTML.unparse(text=text, entities=entities) == expected
|
||||||
|
Loading…
Reference in New Issue
Block a user