mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: add support init fields from parent object in KeyboardButton (#344)
* fix: add support init fields from parent object in KeyboardButton * fix: add tests
This commit is contained in:
parent
cb0a898487
commit
70767111c4
3 changed files with 21 additions and 2 deletions
|
|
@ -111,11 +111,13 @@ class KeyboardButton(base.TelegramObject):
|
|||
def __init__(self, text: base.String,
|
||||
request_contact: base.Boolean = None,
|
||||
request_location: base.Boolean = None,
|
||||
request_poll: KeyboardButtonPollType = None):
|
||||
request_poll: KeyboardButtonPollType = None,
|
||||
**kwargs):
|
||||
super(KeyboardButton, self).__init__(text=text,
|
||||
request_contact=request_contact,
|
||||
request_location=request_location,
|
||||
request_poll=request_poll)
|
||||
request_poll=request_poll,
|
||||
**kwargs)
|
||||
|
||||
|
||||
class ReplyKeyboardRemove(base.TelegramObject):
|
||||
|
|
|
|||
|
|
@ -457,3 +457,8 @@ WEBHOOK_INFO = {
|
|||
"has_custom_certificate": False,
|
||||
"pending_update_count": 0,
|
||||
}
|
||||
|
||||
REPLY_KEYBOARD_MARKUP = {
|
||||
"keyboard": [[{"text": "something here"}]],
|
||||
"resize_keyboard": True,
|
||||
}
|
||||
|
|
|
|||
12
tests/types/test_reply_keyboard.py
Normal file
12
tests/types/test_reply_keyboard.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from aiogram import types
|
||||
from .dataset import REPLY_KEYBOARD_MARKUP
|
||||
|
||||
reply_keyboard = types.ReplyKeyboardMarkup(**REPLY_KEYBOARD_MARKUP)
|
||||
|
||||
|
||||
def test_serialize():
|
||||
assert reply_keyboard.to_python() == REPLY_KEYBOARD_MARKUP
|
||||
|
||||
|
||||
def test_deserialize():
|
||||
assert reply_keyboard.to_object(reply_keyboard.to_python()) == reply_keyboard
|
||||
Loading…
Add table
Add a link
Reference in a new issue