Mikhail Korobov committed fd6357b

Авто-преобразование типов при необходимости

Comments (0)

Files changed (3)

     >>> print pos
     (u'30.271446', u'59.903300')
-    >>> api.get_map_url(api_key, float(pos[0]), float(pos[1]), 13, 200, 300)
+    >>> api.get_map_url(api_key, pos[0], pos[1], 13, 200, 300),59.9033000&size=200,300&z=12&l=map&pt=30.2714460,59.9033000&key=my_api_key


 def get_map_url(api_key, longtitude, latitude, zoom, width, height):
     ''' returns URL of static yandex map '''
     params = [
-       'll=%0.7f,%0.7f' % (longtitude, latitude,),
+       'll=%0.7f,%0.7f' % (float(longtitude), float(latitude),),
        'size=%d,%d' % (width, height,),
        'z=%d' % zoom,
-       'pt=%0.7f,%0.7f' % (longtitude, latitude,),
+       'pt=%0.7f,%0.7f' % (float(longtitude), float(latitude),),
        'key=%s' % api_key
     return STATIC_MAPS_URL + '&'.join(params)


 class MapUrlTest(TestCase):
     def test_map_url(self):
-        url = get_map_url(TEST_API_KEY, float(COORDS[0]), float(COORDS[1]), 5, 200, 300)
+        url = get_map_url(TEST_API_KEY, COORDS[0], COORDS[1], 5, 200, 300)
         self.assertEqual(url, MAP_URL)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.