@@ -55,6 +55,13 @@ def test_send_location_explicit_args(self):
5555 self .assertEqual (location .latitude , self .latitude )
5656 self .assertEqual (location .longitude , self .longitude )
5757
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+
5865 def test_location_de_json (self ):
5966 location = telegram .Location .de_json (self .json_dict , self ._bot )
6067
@@ -78,19 +85,17 @@ def test_error_send_location_empty_args(self):
7885 json_dict ['latitude' ] = ''
7986 json_dict ['longitude' ] = ''
8087
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 )
8490
8591 def test_error_location_without_required_args (self ):
8692 json_dict = self .json_dict
8793
8894 del (json_dict ['latitude' ])
8995 del (json_dict ['longitude' ])
9096
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 )
9499
95100 @flaky (3 , 1 )
96101 def test_reply_location (self ):
0 commit comments