mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-10-24 09:56:30 +02:00
Merge pull request #96 from leandrotoledo/revert-85-master
Revert 1879cff82d
This commit is contained in:
commit
21c26aed2f
3 changed files with 0 additions and 78 deletions
|
@ -13,7 +13,6 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||||
- `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_
|
- `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_
|
||||||
- `franciscod <https://github.com/franciscod>`_
|
- `franciscod <https://github.com/franciscod>`_
|
||||||
- `JASON0916 <https://github.com/JASON0916>`_
|
- `JASON0916 <https://github.com/JASON0916>`_
|
||||||
- `jh0ker <https://github.com/jh0ker>`_
|
|
||||||
- `JRoot3D <https://github.com/JRoot3D>`_
|
- `JRoot3D <https://github.com/JRoot3D>`_
|
||||||
- `macrojames <https://github.com/macrojames>`_
|
- `macrojames <https://github.com/macrojames>`_
|
||||||
- `njittam <https://github.com/njittam>`_
|
- `njittam <https://github.com/njittam>`_
|
||||||
|
|
|
@ -20,43 +20,10 @@
|
||||||
|
|
||||||
"""This module contains a object that represents an Emoji"""
|
"""This module contains a object that represents an Emoji"""
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def call_decode_byte_strings(cls):
|
|
||||||
"""
|
|
||||||
Calls the _decode_byte_strings function of the created class
|
|
||||||
|
|
||||||
Args:
|
|
||||||
cls (Class):
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Class:
|
|
||||||
"""
|
|
||||||
|
|
||||||
cls._decode_byte_strings()
|
|
||||||
return cls
|
|
||||||
|
|
||||||
@call_decode_byte_strings
|
|
||||||
class Emoji(object):
|
class Emoji(object):
|
||||||
"""This object represents an Emoji."""
|
"""This object represents an Emoji."""
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _decode_byte_strings(cls):
|
|
||||||
"""
|
|
||||||
Decodes the Emojis into unicode strings if using Python 3
|
|
||||||
|
|
||||||
Args:
|
|
||||||
cls (Class):
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
"""
|
|
||||||
|
|
||||||
if sys.version_info.major is 3:
|
|
||||||
emojis = filter(lambda attr : type(getattr(cls, attr)) is bytes,
|
|
||||||
dir(cls))
|
|
||||||
for var in emojis:
|
|
||||||
setattr(cls, var, getattr(cls, var).decode('utf-8'))
|
|
||||||
|
|
||||||
GRINNING_FACE_WITH_SMILING_EYES = b'\xF0\x9F\x98\x81'
|
GRINNING_FACE_WITH_SMILING_EYES = b'\xF0\x9F\x98\x81'
|
||||||
FACE_WITH_TEARS_OF_JOY = b'\xF0\x9F\x98\x82'
|
FACE_WITH_TEARS_OF_JOY = b'\xF0\x9F\x98\x82'
|
||||||
SMILING_FACE_WITH_OPEN_MOUTH = b'\xF0\x9F\x98\x83'
|
SMILING_FACE_WITH_OPEN_MOUTH = b'\xF0\x9F\x98\x83'
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# A library that provides a Python interface to the Telegram Bot API
|
|
||||||
# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# 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
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
|
||||||
|
|
||||||
"""This module contains a object that represents Tests for Telegram Emoji"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import unittest
|
|
||||||
import sys
|
|
||||||
sys.path.append('.')
|
|
||||||
|
|
||||||
import telegram
|
|
||||||
from telegram.emoji import Emoji
|
|
||||||
from tests.base import BaseTest
|
|
||||||
|
|
||||||
|
|
||||||
class EmojiTest(BaseTest, unittest.TestCase):
|
|
||||||
"""This object represents Tests for Telegram Emoji."""
|
|
||||||
|
|
||||||
def test_emoji(self):
|
|
||||||
"""Test Emoji class"""
|
|
||||||
print('Testing Emoji class')
|
|
||||||
|
|
||||||
for attr in dir(Emoji):
|
|
||||||
if attr[0] != '_': # TODO: dirty way to filter out functions
|
|
||||||
self.assertTrue(type(getattr(Emoji, attr)) is str)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
Loading…
Reference in a new issue