mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
* #944 Rename "extract()" to "extract_from()" for entities
This commit is contained in:
parent
fadb11515e
commit
b8893c0971
3 changed files with 18 additions and 2 deletions
|
|
@ -1,7 +1,13 @@
|
|||
from aiogram.types import MessageEntity
|
||||
from tests.deprecated import check_deprecated
|
||||
|
||||
|
||||
class TestMessageEntity:
|
||||
def test_extract_from(self):
|
||||
entity = MessageEntity(type="hashtag", length=4, offset=5)
|
||||
assert entity.extract_from("#foo #bar #baz") == "#bar"
|
||||
|
||||
def test_extract(self):
|
||||
entity = MessageEntity(type="hashtag", length=4, offset=5)
|
||||
assert entity.extract("#foo #bar #baz") == "#bar"
|
||||
with check_deprecated("3.0b5", exception=AttributeError):
|
||||
assert entity.extract("#foo #bar #baz") == "#bar"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue