Esempio n. 1
0
class TestPoll(object):
    id_ = 'id'
    question = 'Test?'
    options = [PollOption('test', 10), PollOption('test2', 11)]
    is_closed = True

    def test_de_json(self):
        json_dict = {
            'id': self.id_,
            'question': self.question,
            'options': [o.to_dict() for o in self.options],
            'is_closed': self.is_closed
        }
        poll = Poll.de_json(json_dict, None)

        assert poll.id == self.id_
        assert poll.question == self.question
        assert poll.options == self.options
        assert poll.options[0].text == self.options[0].text
        assert poll.options[0].voter_count == self.options[0].voter_count
        assert poll.options[1].text == self.options[1].text
        assert poll.options[1].voter_count == self.options[1].voter_count
        assert poll.is_closed == self.is_closed

    def test_to_dict(self, poll):
        poll_dict = poll.to_dict()

        assert isinstance(poll_dict, dict)
        assert poll_dict['id'] == poll.id
        assert poll_dict['question'] == poll.question
        assert poll_dict['options'] == [o.to_dict() for o in poll.options]
        assert poll_dict['is_closed'] == poll.is_closed
 def _get_poll(self, poll_type):
     import uuid
     from random import randint
     if poll_type == POLL_QUIZ:
         return Poll(
             id=str(uuid.uuid4()),
             question="Are you human?",
             options=[PollOption("Yes", 2),
                      PollOption("No", 5)],
             total_voter_count=7,
             is_closed=False,
             is_anonymous=True,
             type=POLL_QUIZ,
             correct_option_id=0,
             allows_multiple_answers=False,
         )
     else:
         return Poll(
             id=str(uuid.uuid4()),
             question="Are you human?",
             options=[PollOption("Yes", 2),
                      PollOption("No", 5)],
             total_voter_count=7,
             is_closed=False,
             is_anonymous=True,
             type=POLL_REGULAR,
             allows_multiple_answers=False,
         )
Esempio n. 3
0
def poll(bot):
    return Update(
        0,
        poll=Poll(
            1,
            "question",
            [PollOption("1", 0), PollOption("2", 0)],
            0,
            False,
            False,
            Poll.REGULAR,
            True,
        ),
    )
def poll(bot):
    return Update(
        0,
        poll=Poll(
            1,
            'question',
            [PollOption('1', 0), PollOption('2', 0)],
            0,
            False,
            False,
            Poll.REGULAR,
            True,
        ),
    )
Esempio n. 5
0
class TestPoll(object):
    id_ = 'id'
    question = 'Test?'
    options = [PollOption('test', 10), PollOption('test2', 11)]
    total_voter_count = 0
    is_closed = True
    is_anonymous = False
    type = Poll.REGULAR
    allows_multiple_answers = True

    def test_de_json(self):
        json_dict = {
            'id': self.id_,
            'question': self.question,
            'options': [o.to_dict() for o in self.options],
            'total_voter_count': self.total_voter_count,
            'is_closed': self.is_closed,
            'is_anonymous': self.is_anonymous,
            'type': self.type,
            'allows_multiple_answers': self.allows_multiple_answers
        }
        poll = Poll.de_json(json_dict, None)

        assert poll.id == self.id_
        assert poll.question == self.question
        assert poll.options == self.options
        assert poll.options[0].text == self.options[0].text
        assert poll.options[0].voter_count == self.options[0].voter_count
        assert poll.options[1].text == self.options[1].text
        assert poll.options[1].voter_count == self.options[1].voter_count
        assert poll.total_voter_count == self.total_voter_count
        assert poll.is_closed == self.is_closed
        assert poll.is_anonymous == self.is_anonymous
        assert poll.type == self.type
        assert poll.allows_multiple_answers == self.allows_multiple_answers

    def test_to_dict(self, poll):
        poll_dict = poll.to_dict()

        assert isinstance(poll_dict, dict)
        assert poll_dict['id'] == poll.id
        assert poll_dict['question'] == poll.question
        assert poll_dict['options'] == [o.to_dict() for o in poll.options]
        assert poll_dict['total_voter_count'] == poll.total_voter_count
        assert poll_dict['is_closed'] == poll.is_closed
        assert poll_dict['is_anonymous'] == poll.is_anonymous
        assert poll_dict['type'] == poll.type
        assert poll_dict[
            'allows_multiple_answers'] == poll.allows_multiple_answers
Esempio n. 6
0
    def test_de_json(self):
        json_dict = {
            'text': self.text,
            'voter_count': self.voter_count
        }
        poll_option = PollOption.de_json(json_dict, None)

        assert poll_option.text == self.text
        assert poll_option.voter_count == self.voter_count
Esempio n. 7
0
    def test_equality(self):
        a = PollOption('text', 1)
        b = PollOption('text', 1)
        c = PollOption('text_1', 1)
        d = PollOption('text', 2)
        e = Poll(123, 'question', ['O1', 'O2'], 1, False, True, Poll.REGULAR, True)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)

        assert a != e
        assert hash(a) != hash(e)
Esempio n. 8
0
    def test_equality(self):
        a = PollOption("text", 1)
        b = PollOption("text", 1)
        c = PollOption("text_1", 1)
        d = PollOption("text", 2)
        e = Poll(123, "question", ["O1", "O2"], 1, False, True, Poll.REGULAR,
                 True)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)

        assert a != e
        assert hash(a) != hash(e)
Esempio n. 9
0
    def test_equality(self):
        a = Poll(123, 'question', ['O1', 'O2'], 1, False, True, Poll.REGULAR, True)
        b = Poll(123, 'question', ['o1', 'o2'], 1, True, False, Poll.REGULAR, True)
        c = Poll(456, 'question', ['o1', 'o2'], 1, True, False, Poll.REGULAR, True)
        d = PollOption('Text', 1)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)
Esempio n. 10
0
    def test_parse_entity(self, poll):
        entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
        poll.explanation_entities = [entity]

        assert poll.parse_explanation_entity(entity) == "http://google.com"

        with pytest.raises(RuntimeError, match="Poll has no"):
            Poll(
                "id",
                "question",
                [PollOption("text", voter_count=0)],
                total_voter_count=0,
                is_closed=False,
                is_anonymous=False,
                type=Poll.QUIZ,
                allows_multiple_answers=False,
            ).parse_explanation_entity(entity)
Esempio n. 11
0
    def test_equality(self):
        a = Poll(123, "question", ["O1", "O2"], 1, False, True, Poll.REGULAR,
                 True)
        b = Poll(123, "question", ["o1", "o2"], 1, True, False, Poll.REGULAR,
                 True)
        c = Poll(456, "question", ["o1", "o2"], 1, True, False, Poll.REGULAR,
                 True)
        d = PollOption("Text", 1)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)
Esempio n. 12
0
    def test_equality(self):
        a = PollAnswer(123, self.user, [2])
        b = PollAnswer(123, User(1, 'first', False), [2])
        c = PollAnswer(123, self.user, [1, 2])
        d = PollAnswer(456, self.user, [2])
        e = PollOption('Text', 1)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)

        assert a != e
        assert hash(a) != hash(e)
Esempio n. 13
0
class TestPoll:
    id_ = 'id'
    question = 'Test?'
    options = [PollOption('test', 10), PollOption('test2', 11)]
    total_voter_count = 0
    is_closed = True
    is_anonymous = False
    type = Poll.REGULAR
    allows_multiple_answers = True
    explanation = (b'\\U0001f469\\u200d\\U0001f469\\u200d\\U0001f467'
                   b'\\u200d\\U0001f467\\U0001f431http://google.com'
                   ).decode('unicode-escape')
    explanation_entities = [MessageEntity(13, 17, MessageEntity.URL)]
    open_period = 42
    close_date = datetime.utcnow()

    def test_de_json(self, bot):
        json_dict = {
            'id': self.id_,
            'question': self.question,
            'options': [o.to_dict() for o in self.options],
            'total_voter_count': self.total_voter_count,
            'is_closed': self.is_closed,
            'is_anonymous': self.is_anonymous,
            'type': self.type,
            'allows_multiple_answers': self.allows_multiple_answers,
            'explanation': self.explanation,
            'explanation_entities': [self.explanation_entities[0].to_dict()],
            'open_period': self.open_period,
            'close_date': to_timestamp(self.close_date),
        }
        poll = Poll.de_json(json_dict, bot)

        assert poll.id == self.id_
        assert poll.question == self.question
        assert poll.options == self.options
        assert poll.options[0].text == self.options[0].text
        assert poll.options[0].voter_count == self.options[0].voter_count
        assert poll.options[1].text == self.options[1].text
        assert poll.options[1].voter_count == self.options[1].voter_count
        assert poll.total_voter_count == self.total_voter_count
        assert poll.is_closed == self.is_closed
        assert poll.is_anonymous == self.is_anonymous
        assert poll.type == self.type
        assert poll.allows_multiple_answers == self.allows_multiple_answers
        assert poll.explanation == self.explanation
        assert poll.explanation_entities == self.explanation_entities
        assert poll.open_period == self.open_period
        assert pytest.approx(poll.close_date == self.close_date)
        assert to_timestamp(poll.close_date) == to_timestamp(self.close_date)

    def test_to_dict(self, poll):
        poll_dict = poll.to_dict()

        assert isinstance(poll_dict, dict)
        assert poll_dict['id'] == poll.id
        assert poll_dict['question'] == poll.question
        assert poll_dict['options'] == [o.to_dict() for o in poll.options]
        assert poll_dict['total_voter_count'] == poll.total_voter_count
        assert poll_dict['is_closed'] == poll.is_closed
        assert poll_dict['is_anonymous'] == poll.is_anonymous
        assert poll_dict['type'] == poll.type
        assert poll_dict[
            'allows_multiple_answers'] == poll.allows_multiple_answers
        assert poll_dict['explanation'] == poll.explanation
        assert poll_dict['explanation_entities'] == [
            poll.explanation_entities[0].to_dict()
        ]
        assert poll_dict['open_period'] == poll.open_period
        assert poll_dict['close_date'] == to_timestamp(poll.close_date)

    def test_parse_entity(self, poll):
        entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
        poll.explanation_entities = [entity]

        assert poll.parse_explanation_entity(entity) == 'http://google.com'

    def test_parse_entities(self, poll):
        entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
        entity_2 = MessageEntity(type=MessageEntity.BOLD, offset=13, length=1)
        poll.explanation_entities = [entity_2, entity]

        assert poll.parse_explanation_entities(MessageEntity.URL) == {
            entity: 'http://google.com'
        }
        assert poll.parse_explanation_entities() == {
            entity: 'http://google.com',
            entity_2: 'h'
        }

    def test_equality(self):
        a = Poll(123, 'question', ['O1', 'O2'], 1, False, True, Poll.REGULAR,
                 True)
        b = Poll(123, 'question', ['o1', 'o2'], 1, True, False, Poll.REGULAR,
                 True)
        c = Poll(456, 'question', ['o1', 'o2'], 1, True, False, Poll.REGULAR,
                 True)
        d = PollOption('Text', 1)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)
     {'migrate_to_chat_id': -12345},
     {'migrate_from_chat_id': -54321},
     {'pinned_message': Message(7, None, None, None)},
     {'invoice': Invoice('my invoice', 'invoice', 'start', 'EUR', 243)},
     {'successful_payment': SuccessfulPayment('EUR', 243, 'payload',
                                              'charge_id', 'provider_id',
                                              order_info={})},
     {'connected_website': 'http://example.com/'},
     {'forward_signature': 'some_forward_sign'},
     {'author_signature': 'some_author_sign'},
     {'photo': [PhotoSize('photo_id', 'unique_id', 50, 50)],
      'caption': 'photo_file',
      'media_group_id': 1234443322222},
     {'passport_data': PassportData.de_json(RAW_PASSPORT_DATA, None)},
     {'poll': Poll(id='abc', question='What is this?',
                   options=[PollOption(text='a', voter_count=1),
                            PollOption(text='b', voter_count=2)], is_closed=False,
                   total_voter_count=0, is_anonymous=False, type=Poll.REGULAR,
                   allows_multiple_answers=True)},
     {'text': 'a text message', 'reply_markup': {'inline_keyboard': [[{
         'text': 'start', 'url': 'http://google.com'}, {
         'text': 'next', 'callback_data': 'abcd'}],
         [{'text': 'Cancel', 'callback_data': 'Cancel'}]]}},
     {'quote': True}
 ],
 ids=['forwarded_user', 'forwarded_channel', 'reply', 'edited', 'text',
      'caption_entities', 'audio', 'document', 'animation', 'game', 'photo',
      'sticker', 'video', 'voice', 'video_note', 'new_members', 'contact',
      'location', 'venue', 'left_member', 'new_title', 'new_photo', 'delete_photo',
      'group_created', 'supergroup_created', 'channel_created', 'migrated_to',
      'migrated_from', 'pinned', 'invoice', 'successful_payment',
Esempio n. 15
0
    'edited_channel_post': message
}, {
    'inline_query': InlineQuery(1, User(1, '', False), '', '')
}, {
    'chosen_inline_result':
    ChosenInlineResult('id', User(1, '', False), '')
}, {
    'shipping_query': ShippingQuery('id', User(1, '', False), '', None)
}, {
    'pre_checkout_query':
    PreCheckoutQuery('id', User(1, '', False), '', 0, '')
}, {
    'callback_query': CallbackQuery(1, User(1, '', False), 'chat')
}, {
    'poll':
    Poll('id', '?', [PollOption('.', 1)], False, False, False, Poll.REGULAR,
         True)
}, {
    'poll_answer': PollAnswer("id", User(1, '', False), [1])
}]

all_types = ('message', 'edited_message', 'callback_query', 'channel_post',
             'edited_channel_post', 'inline_query', 'chosen_inline_result',
             'shipping_query', 'pre_checkout_query', 'poll', 'poll_answer')

ids = all_types + ('callback_query_without_message', )


@pytest.fixture(params=params, ids=ids)
def update(request):
    return Update(update_id=TestUpdate.update_id, **request.param)
Esempio n. 16
0
class TestPoll:
    id_ = "id"
    question = "Test?"
    options = [PollOption("test", 10), PollOption("test2", 11)]
    total_voter_count = 0
    is_closed = True
    is_anonymous = False
    type = Poll.REGULAR
    allows_multiple_answers = True
    explanation = (b"\\U0001f469\\u200d\\U0001f469\\u200d\\U0001f467"
                   b"\\u200d\\U0001f467\\U0001f431http://google.com"
                   ).decode("unicode-escape")
    explanation_entities = [MessageEntity(13, 17, MessageEntity.URL)]
    open_period = 42
    close_date = datetime.now(timezone.utc)

    def test_de_json(self, bot):
        json_dict = {
            "id": self.id_,
            "question": self.question,
            "options": [o.to_dict() for o in self.options],
            "total_voter_count": self.total_voter_count,
            "is_closed": self.is_closed,
            "is_anonymous": self.is_anonymous,
            "type": self.type,
            "allows_multiple_answers": self.allows_multiple_answers,
            "explanation": self.explanation,
            "explanation_entities": [self.explanation_entities[0].to_dict()],
            "open_period": self.open_period,
            "close_date": to_timestamp(self.close_date),
        }
        poll = Poll.de_json(json_dict, bot)

        assert poll.id == self.id_
        assert poll.question == self.question
        assert poll.options == self.options
        assert poll.options[0].text == self.options[0].text
        assert poll.options[0].voter_count == self.options[0].voter_count
        assert poll.options[1].text == self.options[1].text
        assert poll.options[1].voter_count == self.options[1].voter_count
        assert poll.total_voter_count == self.total_voter_count
        assert poll.is_closed == self.is_closed
        assert poll.is_anonymous == self.is_anonymous
        assert poll.type == self.type
        assert poll.allows_multiple_answers == self.allows_multiple_answers
        assert poll.explanation == self.explanation
        assert poll.explanation_entities == self.explanation_entities
        assert poll.open_period == self.open_period
        assert abs(poll.close_date - self.close_date) < timedelta(seconds=1)
        assert to_timestamp(poll.close_date) == to_timestamp(self.close_date)

    def test_to_dict(self, poll):
        poll_dict = poll.to_dict()

        assert isinstance(poll_dict, dict)
        assert poll_dict["id"] == poll.id
        assert poll_dict["question"] == poll.question
        assert poll_dict["options"] == [o.to_dict() for o in poll.options]
        assert poll_dict["total_voter_count"] == poll.total_voter_count
        assert poll_dict["is_closed"] == poll.is_closed
        assert poll_dict["is_anonymous"] == poll.is_anonymous
        assert poll_dict["type"] == poll.type
        assert poll_dict[
            "allows_multiple_answers"] == poll.allows_multiple_answers
        assert poll_dict["explanation"] == poll.explanation
        assert poll_dict["explanation_entities"] == [
            poll.explanation_entities[0].to_dict()
        ]
        assert poll_dict["open_period"] == poll.open_period
        assert poll_dict["close_date"] == to_timestamp(poll.close_date)

    def test_enum_init(self):
        poll = Poll(
            type="foo",
            id="id",
            question="question",
            options=[],
            total_voter_count=0,
            is_closed=False,
            is_anonymous=False,
            allows_multiple_answers=False,
        )
        assert poll.type == "foo"
        poll = Poll(
            type=PollType.QUIZ,
            id="id",
            question="question",
            options=[],
            total_voter_count=0,
            is_closed=False,
            is_anonymous=False,
            allows_multiple_answers=False,
        )
        assert poll.type is PollType.QUIZ

    def test_parse_entity(self, poll):
        entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
        poll.explanation_entities = [entity]

        assert poll.parse_explanation_entity(entity) == "http://google.com"

        with pytest.raises(RuntimeError, match="Poll has no"):
            Poll(
                "id",
                "question",
                [PollOption("text", voter_count=0)],
                total_voter_count=0,
                is_closed=False,
                is_anonymous=False,
                type=Poll.QUIZ,
                allows_multiple_answers=False,
            ).parse_explanation_entity(entity)

    def test_parse_entities(self, poll):
        entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
        entity_2 = MessageEntity(type=MessageEntity.BOLD, offset=13, length=1)
        poll.explanation_entities = [entity_2, entity]

        assert poll.parse_explanation_entities(MessageEntity.URL) == {
            entity: "http://google.com"
        }
        assert poll.parse_explanation_entities() == {
            entity: "http://google.com",
            entity_2: "h"
        }

    def test_equality(self):
        a = Poll(123, "question", ["O1", "O2"], 1, False, True, Poll.REGULAR,
                 True)
        b = Poll(123, "question", ["o1", "o2"], 1, True, False, Poll.REGULAR,
                 True)
        c = Poll(456, "question", ["o1", "o2"], 1, True, False, Poll.REGULAR,
                 True)
        d = PollOption("Text", 1)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)
    ChatMember(User(1, '', False), ChatMember.CREATOR),
    ChatMember(User(1, '', False), ChatMember.CREATOR),
)

params = [
    {'message': message},
    {'edited_message': message},
    {'callback_query': CallbackQuery(1, User(1, '', False), 'chat', message=message)},
    {'channel_post': message},
    {'edited_channel_post': message},
    {'inline_query': InlineQuery(1, User(1, '', False), '', '')},
    {'chosen_inline_result': ChosenInlineResult('id', User(1, '', False), '')},
    {'shipping_query': ShippingQuery('id', User(1, '', False), '', None)},
    {'pre_checkout_query': PreCheckoutQuery('id', User(1, '', False), '', 0, '')},
    {'callback_query': CallbackQuery(1, User(1, '', False), 'chat')},
    {'poll': Poll('id', '?', [PollOption('.', 1)], False, False, False, Poll.REGULAR, True)},
    {'poll_answer': PollAnswer("id", User(1, '', False), [1])},
    {'my_chat_member': chat_member_updated},
    {'chat_member': chat_member_updated},
]

all_types = (
    'message',
    'edited_message',
    'callback_query',
    'channel_post',
    'edited_channel_post',
    'inline_query',
    'chosen_inline_result',
    'shipping_query',
    'pre_checkout_query',
Esempio n. 18
0
}, {
    'edited_channel_post': message
}, {
    'inline_query': InlineQuery(1, User(1, '', False), '', '')
}, {
    'chosen_inline_result':
    ChosenInlineResult('id', User(1, '', False), '')
}, {
    'shipping_query': ShippingQuery('id', User(1, '', False), '', None)
}, {
    'pre_checkout_query':
    PreCheckoutQuery('id', User(1, '', False), '', 0, '')
}, {
    'callback_query': CallbackQuery(1, User(1, '', False), 'chat')
}, {
    'poll': Poll('id', '?', [PollOption('.', 1)], False)
}]

all_types = ('message', 'edited_message', 'callback_query', 'channel_post',
             'edited_channel_post', 'inline_query', 'chosen_inline_result',
             'shipping_query', 'pre_checkout_query', 'poll')

ids = all_types + ('callback_query_without_message', )


@pytest.fixture(params=params, ids=ids)
def update(request):
    return Update(update_id=TestUpdate.update_id, **request.param)


class TestUpdate(object):
Esempio n. 19
0
def poll_option():
    return PollOption(text=TestPollOption.text,
                      voter_count=TestPollOption.voter_count)
Esempio n. 20
0
     'inline_query': InlineQuery(1, User(1, '', False), '', '')
 },
 {
     'chosen_inline_result': ChosenInlineResult('id', User(1, '', False),
                                                '')
 },
 {
     'shipping_query': ShippingQuery('id', User(1, '', False), '', None)
 },
 {
     'pre_checkout_query': PreCheckoutQuery('id', User(1, '', False), '', 0,
                                            '')
 },
 {
     'poll':
     Poll('id', '?', [PollOption('.', 1)], False, False, False,
          Poll.REGULAR, True)
 },
 {
     'poll_answer': PollAnswer("id", User(1, '', False), [1])
 },
 {
     'my_chat_member': chat_member_updated
 },
 {
     'chat_member': chat_member_updated
 },
 {
     'chat_join_request': chat_join_request
 },
 # Must be last to conform with `ids` below!
Esempio n. 21
0
     "inline_query": InlineQuery(1, User(1, "", False), "", "")
 },
 {
     "chosen_inline_result": ChosenInlineResult("id", User(1, "", False),
                                                "")
 },
 {
     "shipping_query": ShippingQuery("id", User(1, "", False), "", None)
 },
 {
     "pre_checkout_query": PreCheckoutQuery("id", User(1, "", False), "", 0,
                                            "")
 },
 {
     "poll":
     Poll("id", "?", [PollOption(".", 1)], False, False, False,
          Poll.REGULAR, True)
 },
 {
     "poll_answer": PollAnswer("id", User(1, "", False), [1])
 },
 {
     "my_chat_member": chat_member_updated
 },
 {
     "chat_member": chat_member_updated
 },
 {
     "chat_join_request": chat_join_request
 },
 # Must be last to conform with `ids` below!
 },
 {
     'photo': [PhotoSize('photo_id', 'unique_id', 50, 50)],
     'caption': 'photo_file',
     'media_group_id': 1234443322222,
 },
 {
     'passport_data': PassportData.de_json(RAW_PASSPORT_DATA, None)
 },
 {
     'poll':
     Poll(
         id='abc',
         question='What is this?',
         options=[
             PollOption(text='a', voter_count=1),
             PollOption(text='b', voter_count=2)
         ],
         is_closed=False,
         total_voter_count=0,
         is_anonymous=False,
         type=Poll.REGULAR,
         allows_multiple_answers=True,
         explanation_entities=[],
     )
 },
 {
     'text': 'a text message',
     'reply_markup': {
         'inline_keyboard': [
             [
Esempio n. 23
0
 def send_poll(*args, **kwargs):
     nonlocal poll_message
     poll_message = fake_poll()
     poll_message.poll.options = [PollOption(o, 0) for o in kwargs['options']]
     return poll_message