
from geopy.compat import u
from geopy.geocoders import OpenMapQuest
from test.geocoders.util import GeocoderTestBase


class OpenMapQuestTestCase(GeocoderTestBase): # pylint: disable=R0904,C0111

    @classmethod
    def setUpClass(cls):
        cls.geocoder = OpenMapQuest(scheme='http', timeout=3)
        cls.delta = 0.04

    def test_user_agent_custom(self):
        geocoder = OpenMapQuest(
            user_agent='my_user_agent/1.0'
        )
        self.assertEqual(geocoder.headers['User-Agent'], 'my_user_agent/1.0')

    def test_geocode(self):
        """
        OpenMapQuest.geocode
        """
        self.geocode_run(
            {"query": "435 north michigan ave, chicago il 60611 usa"},
            {"latitude": 41.890, "longitude": -87.624},
        )

    def test_unicode_name(self):
        """
        OpenMapQuest.geocode unicode
        """
        self.geocode_run(
            {"query": u("\u6545\u5bab")},
            {"latitude": 39.916, "longitude": 116.390},
        )

@@ -110,18 +110,182 @@
 TestBase
-%0A%0A
+, env%0Aimport unittest%0A%0A%0A@unittest.skipUnless(  # pylint: disable=R0904,C0111%0A    bool(env.get('OPENMAPQUEST_APIKEY')),%0A    %22No OPENMAPQUEST_APIKEY env variable set%22%0A)
 %0Aclass O
@@ -322,16 +322,17 @@
 stBase):
+ 
  # pylin
@@ -457,16 +457,52 @@
 imeout=3
+, api_key=env%5B'OPENMAPQUEST_APIKEY'%5D
 )%0A      

Make OpenMapQuest tests conditional on environment variable