@@ -55,6 +55,13 @@ def test_send_location_explicit_args(self):
55
55
self .assertEqual (location .latitude , self .latitude )
56
56
self .assertEqual (location .longitude , self .longitude )
57
57
58
+ def test_send_location_with_location (self ):
59
+ loc = telegram .Location (longitude = self .longitude , latitude = self .latitude )
60
+ message = self ._bot .send_location (location = loc , chat_id = self ._chat_id )
61
+ location = message .location
62
+
63
+ self .assertEqual (location , loc )
64
+
58
65
def test_location_de_json (self ):
59
66
location = telegram .Location .de_json (self .json_dict , self ._bot )
60
67
@@ -78,19 +85,17 @@ def test_error_send_location_empty_args(self):
78
85
json_dict ['latitude' ] = ''
79
86
json_dict ['longitude' ] = ''
80
87
81
- self .assertRaises (telegram .TelegramError ,
82
- lambda : self ._bot .sendLocation (chat_id = self ._chat_id ,
83
- ** json_dict ))
88
+ with self .assertRaises (TypeError ):
89
+ self ._bot .sendLocation (chat_id = self ._chat_id , ** json_dict )
84
90
85
91
def test_error_location_without_required_args (self ):
86
92
json_dict = self .json_dict
87
93
88
94
del (json_dict ['latitude' ])
89
95
del (json_dict ['longitude' ])
90
96
91
- self .assertRaises (TypeError ,
92
- lambda : self ._bot .sendLocation (chat_id = self ._chat_id ,
93
- ** json_dict ))
97
+ with self .assertRaises (ValueError ):
98
+ self ._bot .sendLocation (chat_id = self ._chat_id , ** json_dict )
94
99
95
100
@flaky (3 , 1 )
96
101
def test_reply_location (self ):
0 commit comments