mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Remove deprecated code
This commit is contained in:
parent
23b6461249
commit
6fbc1bcfde
2 changed files with 0 additions and 15 deletions
|
|
@ -1,6 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import warnings
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from ..utils.text_decorations import add_surrogates, remove_surrogates
|
||||
|
|
@ -36,11 +35,3 @@ class MessageEntity(MutableTelegramObject):
|
|||
return remove_surrogates(
|
||||
add_surrogates(text)[self.offset * 2 : (self.offset + self.length) * 2]
|
||||
)
|
||||
|
||||
def extract(self, text: str) -> str:
|
||||
warnings.warn(
|
||||
"Method `MessageEntity.extract(...)` deprecated and will be removed in 3.0b5.\n"
|
||||
" Use `MessageEntity.extract_from(...)` instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
return self.extract_from(text=text)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
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)
|
||||
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