mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
feat(utils): deprecated descriptor
deprecate CHOSEN_INLINE_QUERY and always return CHOSEN_INLINE_RESULT instead of incorrect value
This commit is contained in:
parent
4603961321
commit
4f6cb405c8
3 changed files with 60 additions and 2 deletions
19
tests/test_utils/test_deprecated.py
Normal file
19
tests/test_utils/test_deprecated.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.utils.deprecated import DeprecatedReadOnlyClassVar
|
||||
|
||||
|
||||
def test_DeprecatedReadOnlyClassVarCD():
|
||||
assert DeprecatedReadOnlyClassVar.__slots__ == ("_new_value_getter", "_warning_message")
|
||||
|
||||
new_value_of_deprecated_cls_cd = "mpa"
|
||||
pseudo_owner_cls = type("OpekaCla$$", (), {})
|
||||
deprecated_cd = DeprecatedReadOnlyClassVar("mopekaa", lambda owner: new_value_of_deprecated_cls_cd)
|
||||
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert deprecated_cd.__get__(None, pseudo_owner_cls) == new_value_of_deprecated_cls_cd
|
||||
|
||||
class MyClass:
|
||||
some_attribute: DeprecatedReadOnlyClassVar["MyClass", int] = \
|
||||
DeprecatedReadOnlyClassVar(
|
||||
"Warning message.", lambda owner: 15)
|
||||
Loading…
Add table
Add a link
Reference in a new issue