@@ -54,26 +54,22 @@ def testGetMe(self):
54
54
@flaky (3 , 1 )
55
55
@timeout (10 )
56
56
def testSendMessage (self ):
57
- message = self ._bot .sendMessage (
58
- chat_id = self ._chat_id ,
59
- text = 'Моё судно на воздушной подушке полно угрей' )
57
+ message = self ._bot .sendMessage (chat_id = self ._chat_id ,
58
+ text = 'Моё судно на воздушной подушке полно угрей' )
60
59
61
60
self .assertTrue (self .is_json (message .to_json ()))
62
- self .assertEqual (message .text ,
63
- u'Моё судно на воздушной подушке полно угрей' )
61
+ self .assertEqual (message .text , u'Моё судно на воздушной подушке полно угрей' )
64
62
self .assertTrue (isinstance (message .date , datetime ))
65
63
66
64
@flaky (3 , 1 )
67
65
@timeout (10 )
68
66
def testSilentSendMessage (self ):
69
- message = self ._bot .sendMessage (
70
- chat_id = self ._chat_id ,
71
- text = 'Моё судно на воздушной подушке полно угрей' ,
72
- disable_notification = True )
67
+ message = self ._bot .sendMessage (chat_id = self ._chat_id ,
68
+ text = 'Моё судно на воздушной подушке полно угрей' ,
69
+ disable_notification = True )
73
70
74
71
self .assertTrue (self .is_json (message .to_json ()))
75
- self .assertEqual (message .text ,
76
- u'Моё судно на воздушной подушке полно угрей' )
72
+ self .assertEqual (message .text , u'Моё судно на воздушной подушке полно угрей' )
77
73
self .assertTrue (isinstance (message .date , datetime ))
78
74
79
75
@flaky (3 , 1 )
@@ -100,10 +96,9 @@ def testForwardMessage(self):
100
96
@flaky (3 , 1 )
101
97
@timeout (10 )
102
98
def testSendPhoto (self ):
103
- message = self ._bot .sendPhoto (
104
- photo = open ('tests/data/telegram.png' , 'rb' ),
105
- caption = 'testSendPhoto' ,
106
- chat_id = self ._chat_id )
99
+ message = self ._bot .sendPhoto (photo = open ('tests/data/telegram.png' , 'rb' ),
100
+ caption = 'testSendPhoto' ,
101
+ chat_id = self ._chat_id )
107
102
108
103
self .assertTrue (self .is_json (message .to_json ()))
109
104
self .assertEqual (message .photo [0 ].file_size , 1451 )
@@ -112,11 +107,10 @@ def testSendPhoto(self):
112
107
@flaky (3 , 1 )
113
108
@timeout (10 )
114
109
def testSilentSendPhoto (self ):
115
- message = self ._bot .sendPhoto (
116
- photo = open ('tests/data/telegram.png' , 'rb' ),
117
- caption = 'testSendPhoto' ,
118
- chat_id = self ._chat_id ,
119
- disable_notification = True )
110
+ message = self ._bot .sendPhoto (photo = open ('tests/data/telegram.png' , 'rb' ),
111
+ caption = 'testSendPhoto' ,
112
+ chat_id = self ._chat_id ,
113
+ disable_notification = True )
120
114
121
115
self .assertTrue (self .is_json (message .to_json ()))
122
116
self .assertEqual (message .photo [0 ].file_size , 1451 )
@@ -130,9 +124,8 @@ def testResendPhoto(self):
130
124
chat_id = self ._chat_id )
131
125
132
126
self .assertTrue (self .is_json (message .to_json ()))
133
- self .assertEqual (
134
- message .photo [0 ].file_id ,
135
- 'AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI' )
127
+ self .assertEqual (message .photo [0 ].file_id ,
128
+ 'AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI' )
136
129
137
130
@flaky (3 , 1 )
138
131
@timeout (10 )
@@ -177,8 +170,7 @@ def testSendBufferedReaderPhoto(self):
177
170
@flaky (3 , 1 )
178
171
@timeout (10 )
179
172
def testSendChatAction (self ):
180
- self ._bot .sendChatAction (action = telegram .ChatAction .TYPING ,
181
- chat_id = self ._chat_id )
173
+ self ._bot .sendChatAction (action = telegram .ChatAction .TYPING , chat_id = self ._chat_id )
182
174
183
175
@flaky (3 , 1 )
184
176
@timeout (10 )
@@ -189,8 +181,7 @@ def testGetUserProfilePhotos(self):
189
181
self .assertEqual (upf .photos [0 ][0 ].file_size , 12421 )
190
182
191
183
def _test_invalid_token (self , token ):
192
- self .assertRaisesRegexp (telegram .error .InvalidToken , 'Invalid token' ,
193
- telegram .Bot , token )
184
+ self .assertRaisesRegexp (telegram .error .InvalidToken , 'Invalid token' , telegram .Bot , token )
194
185
195
186
def testInvalidToken1 (self ):
196
187
self ._test_invalid_token ('123' )
@@ -202,14 +193,12 @@ def testInvalidToken3(self):
202
193
self ._test_invalid_token ('12:' )
203
194
204
195
def testUnauthToken (self ):
205
- with self .assertRaisesRegexp (telegram .error .Unauthorized ,
206
- 'Unauthorized' ):
196
+ with self .assertRaisesRegexp (telegram .error .Unauthorized , 'Unauthorized' ):
207
197
bot = telegram .Bot ('1234:abcd1234' )
208
198
bot .getMe ()
209
199
210
200
def testInvalidSrvResp (self ):
211
- with self .assertRaisesRegexp (telegram .TelegramError ,
212
- 'Invalid server response' ):
201
+ with self .assertRaisesRegexp (telegram .TelegramError , 'Invalid server response' ):
213
202
# bypass the valid token check
214
203
bot = telegram .Bot .__new__ (telegram .Bot )
215
204
bot .base_url = 'https://api.telegram.org/bot{0}' .format ('12' )
0 commit comments