2017-01-20 20:13:58 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
|
|
|
# A library that provides a Python interface to the Telegram Bot API
|
2017-05-14 12:18:29 +02:00
|
|
|
# Copyright (C) 2015-2017
|
2017-01-20 20:13:58 +01:00
|
|
|
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2017-08-11 23:58:41 +02:00
|
|
|
# it under the terms of the GNU Lesser Public License as published by
|
2017-01-20 20:13:58 +01:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2017-08-11 23:58:41 +02:00
|
|
|
# GNU Lesser Public License for more details.
|
2017-01-20 20:13:58 +01:00
|
|
|
#
|
2017-08-11 23:58:41 +02:00
|
|
|
# You should have received a copy of the GNU Lesser Public License
|
2017-01-20 20:13:58 +01:00
|
|
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
|
|
|
|
|
|
|
from telegram.utils import helpers
|
|
|
|
|
|
|
|
|
2017-08-11 23:58:41 +02:00
|
|
|
class TestHelpers(object):
|
2017-01-20 20:13:58 +01:00
|
|
|
def test_escape_markdown(self):
|
2017-08-11 23:58:41 +02:00
|
|
|
test_str = '*bold*, _italic_, `code`, [text_link](http://github.com/)'
|
|
|
|
expected_str = '\*bold\*, \_italic\_, \`code\`, \[text\_link](http://github.com/)'
|
2017-01-20 20:13:58 +01:00
|
|
|
|
2017-08-11 23:58:41 +02:00
|
|
|
assert expected_str == helpers.escape_markdown(test_str)
|