|
19 | 19 | import jinja2 |
20 | 20 | from jinja2 import Environment, PackageLoader |
21 | 21 |
|
| 22 | +import numpy as np |
22 | 23 | import pandas as pd |
23 | 24 |
|
24 | 25 | import pytest |
@@ -62,6 +63,17 @@ def test_get_templates(): |
62 | 63 | assert isinstance(env, jinja2.environment.Environment) |
63 | 64 |
|
64 | 65 |
|
| 66 | +def test_location_args(): |
| 67 | + """Test some data types for a location arg.""" |
| 68 | + location = np.array([45.5236, -122.6750]) |
| 69 | + m = folium.Map(location) |
| 70 | + assert m.location == [45.5236, -122.6750] |
| 71 | + |
| 72 | + df = pd.DataFrame({"location": [45.5236, -122.6750]}) |
| 73 | + m = folium.Map(df["location"]) |
| 74 | + assert m.location == [45.5236, -122.6750] |
| 75 | + |
| 76 | + |
65 | 77 | class TestFolium(object): |
66 | 78 | """Test class for the Folium library.""" |
67 | 79 |
|
@@ -108,9 +120,9 @@ def test_init(self): |
108 | 120 | 'name': 'TileLayer', |
109 | 121 | 'id': '00000000000000000000000000000000', |
110 | 122 | 'children': {} |
111 | | - } |
112 | 123 | } |
113 | 124 | } |
| 125 | + } |
114 | 126 |
|
115 | 127 | def test_cloudmade(self): |
116 | 128 | """Test cloudmade tiles and the API key.""" |
@@ -197,7 +209,8 @@ def test_map_build(self): |
197 | 209 |
|
198 | 210 | # Standard map. |
199 | 211 | self.setup() |
200 | | - rendered = [line.strip() for line in self.m._parent.render().splitlines() if line.strip()] |
| 212 | + rendered = [line.strip() |
| 213 | + for line in self.m._parent.render().splitlines() if line.strip()] |
201 | 214 |
|
202 | 215 | html_templ = self.env.get_template('fol_template.html') |
203 | 216 | attr = 'http://openstreetmap.org' |
@@ -332,7 +345,7 @@ def test_fit_bounds(self): |
332 | 345 | 'padding': (3, 3), }, |
333 | 346 | sort_keys=True), |
334 | 347 | 'this': fitbounds, |
335 | | - }) |
| 348 | + }) |
336 | 349 |
|
337 | 350 | assert ''.join(fit_bounds_rendered.split()) in ''.join(out.split()) |
338 | 351 |
|
|
0 commit comments