X Tutup
Skip to content

Commit 35f6de3

Browse files
committed
Add InlineKeyboardButtonTest and reformatting.
1 parent 1f29093 commit 35f6de3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+255
-206
lines changed

tests/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents a Base class for tests"""
2120

2221
import signal
@@ -37,8 +36,8 @@ class BaseTest(object):
3736
def __init__(self, *args, **kwargs):
3837
super(BaseTest, self).__init__(*args, **kwargs)
3938

40-
bot = telegram.Bot(os.environ.get('TOKEN',
41-
'133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0'))
39+
bot = telegram.Bot(os.environ.get(
40+
'TOKEN', '133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0'))
4241
chat_id = os.environ.get('CHAT_ID', '12173560')
4342

4443
self._bot = bot

tests/test_audio.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram Audio"""
2120

2221
import sys
@@ -56,8 +55,7 @@ def setUp(self):
5655
@flaky(3, 1)
5756
@timeout(10)
5857
def test_send_audio_required_args_only(self):
59-
message = self._bot.sendAudio(self._chat_id,
60-
self.audio_file)
58+
message = self._bot.sendAudio(self._chat_id, self.audio_file)
6159

6260
audio = message.audio
6361

tests/test_bot.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#
1818
# You should have received a copy of the GNU General Public License
1919
# along with this program. If not, see [http://www.gnu.org/licenses/].
20-
2120
"""This module contains a object that represents Tests for Telegram Bot"""
2221

2322
import sys
@@ -55,8 +54,9 @@ def testGetMe(self):
5554
@flaky(3, 1)
5655
@timeout(10)
5756
def testSendMessage(self):
58-
message = self._bot.sendMessage(chat_id=self._chat_id,
59-
text='Моё судно на воздушной подушке полно угрей')
57+
message = self._bot.sendMessage(
58+
chat_id=self._chat_id,
59+
text='Моё судно на воздушной подушке полно угрей')
6060

6161
self.assertTrue(self.is_json(message.to_json()))
6262
self.assertEqual(message.text,
@@ -66,9 +66,10 @@ def testSendMessage(self):
6666
@flaky(3, 1)
6767
@timeout(10)
6868
def testSilentSendMessage(self):
69-
message = self._bot.sendMessage(chat_id=self._chat_id,
70-
text='Моё судно на воздушной подушке полно угрей',
71-
disable_notification=True)
69+
message = self._bot.sendMessage(
70+
chat_id=self._chat_id,
71+
text='Моё судно на воздушной подушке полно угрей',
72+
disable_notification=True)
7273

7374
self.assertTrue(self.is_json(message.to_json()))
7475
self.assertEqual(message.text,
@@ -129,8 +130,9 @@ def testResendPhoto(self):
129130
chat_id=self._chat_id)
130131

131132
self.assertTrue(self.is_json(message.to_json()))
132-
self.assertEqual(message.photo[0].file_id,
133-
'AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI')
133+
self.assertEqual(
134+
message.photo[0].file_id,
135+
'AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI')
134136

135137
@flaky(3, 1)
136138
@timeout(10)
@@ -167,8 +169,7 @@ def testSendGIFURLPhoto(self):
167169
def testSendBufferedReaderPhoto(self):
168170
photo = open('tests/data/telegram.png', 'rb')
169171
br_photo = io.BufferedReader(io.BytesIO(photo.read()))
170-
message = self._bot.sendPhoto(photo=br_photo,
171-
chat_id=self._chat_id)
172+
message = self._bot.sendPhoto(photo=br_photo, chat_id=self._chat_id)
172173

173174
self.assertTrue(self.is_json(message.to_json()))
174175
self.assertEqual(message.photo[0].file_size, 1451)

tests/test_botan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
32
"""This module contains a object that represents Tests for Botan analytics integration"""
43

54
import sys

tests/test_chat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram Chat"""
2120

2221
import sys

tests/test_choseninlineresult.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram
2120
ChosenInlineResult"""
2221

tests/test_contact.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram Contact"""
2120

2221
import sys

tests/test_document.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram Document"""
2120

2221
import sys
@@ -57,8 +56,7 @@ def setUp(self):
5756
@flaky(3, 1)
5857
@timeout(10)
5958
def test_send_document_png_file(self):
60-
message = self._bot.sendDocument(self._chat_id,
61-
self.document_file)
59+
message = self._bot.sendDocument(self._chat_id, self.document_file)
6260

6361
document = message.document
6462

@@ -88,8 +86,7 @@ def test_send_document_png_file_with_custom_file_name(self):
8886
@flaky(3, 1)
8987
@timeout(10)
9088
def test_send_document_url_gif_file(self):
91-
message = self._bot.sendDocument(self._chat_id,
92-
self.document_file_url)
89+
message = self._bot.sendDocument(self._chat_id, self.document_file_url)
9390

9491
document = message.document
9592

tests/test_emoji.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram Emoji"""
2120

2221
import sys

tests/test_file.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# You should have received a copy of the GNU General Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
19-
2019
"""This module contains a object that represents Tests for Telegram File"""
2120

2221
import sys
@@ -42,7 +41,8 @@ def setUp(self):
4241

4342
self.json_dict = {
4443
'file_id': self.audio_file_id,
45-
'file_path': 'https://api.telegram.org/file/bot133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0/document/file_3',
44+
'file_path':
45+
'https://api.telegram.org/file/bot133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0/document/file_3',
4646
'file_size': 28232
4747
}
4848

@@ -137,8 +137,7 @@ def test_error_file_without_required_args(self):
137137
del (json_dict['file_path'])
138138
del (json_dict['file_size'])
139139

140-
self.assertRaises(TypeError,
141-
lambda: self._bot.getFile(**json_dict))
140+
self.assertRaises(TypeError, lambda: self._bot.getFile(**json_dict))
142141

143142

144143
if __name__ == '__main__':

0 commit comments

Comments
 (0)
X Tutup