Beispiel #1
0
def inline_query_result_venue():
    return InlineQueryResultVenue(TestInlineQueryResultVenue.id,
                                  TestInlineQueryResultVenue.latitude,
                                  TestInlineQueryResultVenue.longitude,
                                  TestInlineQueryResultVenue.title,
                                  TestInlineQueryResultVenue.address,
                                  foursquare_id=TestInlineQueryResultVenue.foursquare_id,
                                  thumb_url=TestInlineQueryResultVenue.thumb_url,
                                  thumb_width=TestInlineQueryResultVenue.thumb_width,
                                  thumb_height=TestInlineQueryResultVenue.thumb_height,
                                  input_message_content=TestInlineQueryResultVenue.input_message_content,
                                  reply_markup=TestInlineQueryResultVenue.reply_markup)
Beispiel #2
0
    def test_equality(self):
        a = InlineQueryResultVenue(self.id, self.longitude, self.latitude, self.title,
                                   self.address)
        b = InlineQueryResultVenue(self.id, self.longitude, self.latitude, self.title,
                                   self.address)
        c = InlineQueryResultVenue(self.id, '', self.latitude, self.title, self.address)
        d = InlineQueryResultVenue('', self.longitude, self.latitude, self.title,
                                   self.address)
        e = InlineQueryResultVoice(self.id, '', '')

        assert a == b
        assert hash(a) == hash(b)
        assert a is not 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)
Beispiel #3
0
        def inline_query_handler(update, context):
            logging.log(logging.DEBUG, "inline query")
            try:
                q = update.inline_query.query
                results = [
                    InlineQueryResultVenue(id=x['id'],
                                           latitude=x['latitude'],
                                           longitude=x['longitude'],
                                           title=x['title'],
                                           address=x['address'])
                    for x in self.data_source.get_addresses_results(q)
                ]

                context.bot.answer_inline_query(update.inline_query.id,
                                                results=results)
            except Exception as e:
                pass