Skip to content

Commit

Permalink
Bing user_location test: use coordinates instead of str address for v…
Browse files Browse the repository at this point in the history
…alidation

The string address changes too often, causing unexpected test failure.
  • Loading branch information
KostyaEsmukov committed Mar 22, 2018
1 parent 7b2e008 commit 4fea0f1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/geocoders/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,26 @@ def test_user_location(self):
"""
Bing.geocode using `user_location`
"""
pensylvania = "20 Main St, Blairstown, NJ 07825, United States"
colorado = "20 Main St, Longmont, CO 80501, United States"
pennsylvania = (40.98327, -74.96064)
colorado = (40.1602849999851, -105.102491162672)

pennsylvania_bias = (40.922351, -75.096562)
colorado_bias = (39.914231, -105.070104)
for each in (
(pensylvania, pennsylvania_bias),
for expected, bias in (
(pennsylvania, pennsylvania_bias),
(colorado, colorado_bias)
):
res = self._make_request(
self.geocoder.geocode,
"20 Main Street",
user_location=Point(each[1]),
user_location=Point(bias),
)
if res is None:
unittest.SkipTest("Bing sometimes returns no result")
else:
self.assertEqual(res[0], each[0])
self._verify_request(res,
latitude=expected[0],
longitude=expected[1])

def test_optional_params(self):
"""
Expand Down

0 comments on commit 4fea0f1

Please sign in to comment.