|
14 | 14 | import branca.element
|
15 | 15 |
|
16 | 16 | import folium
|
17 |
| -from folium.features import PolygonMarker, RectangleMarker, TopoJson |
| 17 | +from folium.features import Polygon, Rectangle, TopoJson |
18 | 18 |
|
19 | 19 | import jinja2
|
20 | 20 | from jinja2 import Environment, PackageLoader
|
@@ -201,93 +201,6 @@ def test_feature_group(self):
|
201 | 201 | bounds = m.get_bounds()
|
202 | 202 | assert bounds == [[45, -30], [45, 30]], bounds
|
203 | 203 |
|
204 |
| - def test_rectangle_marker(self): |
205 |
| - """Test rectangle marker additions.""" |
206 |
| - |
207 |
| - self.m = folium.Map(location=[45.60, -122.8]) |
208 |
| - rect_templ = self.env.get_template('rectangle_marker.js') |
209 |
| - |
210 |
| - # Single Rectangle marker. |
211 |
| - bounds = [45.60, -122.8, 45.61, -122.7] |
212 |
| - self.m.add_child(RectangleMarker(bounds=bounds, popup='Hi')) |
213 |
| - marker = list(self.m._children.values())[-1] |
214 |
| - rect_1 = rect_templ.render({'RectangleMarker': marker.get_name(), |
215 |
| - 'location': [45.60, -122.8, 45.61, -122.7], |
216 |
| - 'color': 'black', |
217 |
| - 'fill_color': 'black', |
218 |
| - 'fill_opacity': 0.6, |
219 |
| - 'weight': 1}) |
220 |
| - assert (''.join(rect_1.split())[:-1] in |
221 |
| - ''.join(self.m.get_root().render().split())) |
222 |
| - |
223 |
| - # Second Rectangle marker. |
224 |
| - bounds = [45.70, -122.9, 45.75, -122.5] |
225 |
| - self.m.add_child(RectangleMarker(bounds=bounds, popup='Hi')) |
226 |
| - marker = list(self.m._children.values())[-1] |
227 |
| - rect_2 = rect_templ.render({'RectangleMarker': marker.get_name(), |
228 |
| - 'location': [45.70, -122.9, 45.75, -122.5], |
229 |
| - 'color': 'black', |
230 |
| - 'fill_color': 'black', |
231 |
| - 'fill_opacity': 0.6, |
232 |
| - 'weight': 1}) |
233 |
| - assert (''.join(rect_2.split())[:-1] in |
234 |
| - ''.join(self.m.get_root().render().split())) |
235 |
| - |
236 |
| - bounds = self.m.get_bounds() |
237 |
| - assert bounds == [[45.6, -122.9], [45.7, -122.8]], bounds |
238 |
| - |
239 |
| - def test_polygon_marker(self): |
240 |
| - """Test polygon additions.""" |
241 |
| - |
242 |
| - self.m = folium.Map(location=[45.60, -122.8]) |
243 |
| - polygon_templ = self.env.get_template('polygon.js') |
244 |
| - |
245 |
| - # Single PolygonMarker. |
246 |
| - locations = [[35.6636, 139.7634], |
247 |
| - [35.6629, 139.7664], |
248 |
| - [35.6663, 139.7706], |
249 |
| - [35.6725, 139.7632], |
250 |
| - [35.6728, 139.7627], |
251 |
| - [35.6720, 139.7606], |
252 |
| - [35.6682, 139.7588], |
253 |
| - [35.6663, 139.7627]] |
254 |
| - self.m.add_child(PolygonMarker(locations=locations, popup='Hi')) |
255 |
| - marker = list(self.m._children.values())[-1] |
256 |
| - polygon_1 = polygon_templ.render({'PolygonMarker': marker.get_name(), |
257 |
| - 'location': locations, |
258 |
| - 'color': 'black', |
259 |
| - 'fill_color': 'black', |
260 |
| - 'fill_opacity': 0.6, |
261 |
| - 'weight': 1}) |
262 |
| - assert (''.join(polygon_1.split())[:-1] in |
263 |
| - ''.join(self.m.get_root().render().split())) |
264 |
| - |
265 |
| - # Second PolygonMarker. |
266 |
| - locations = [[35.5636, 138.7634], |
267 |
| - [35.5629, 138.7664], |
268 |
| - [35.5663, 138.7706], |
269 |
| - [35.5725, 138.7632], |
270 |
| - [35.5728, 138.7627], |
271 |
| - [35.5720, 138.7606], |
272 |
| - [35.5682, 138.7588], |
273 |
| - [35.5663, 138.7627]] |
274 |
| - self.m.add_child(PolygonMarker(locations=locations, color='red', |
275 |
| - fill_color='red', fill_opacity=0.7, |
276 |
| - weight=3, popup='Hi')) |
277 |
| - marker = list(self.m._children.values())[-1] |
278 |
| - polygon_2 = polygon_templ.render({'PolygonMarker': marker.get_name(), |
279 |
| - 'location': locations, |
280 |
| - 'color': 'red', |
281 |
| - 'fill_color': 'red', |
282 |
| - 'fill_opacity': 0.7, |
283 |
| - 'weight': 3}) |
284 |
| - assert (''.join(polygon_2.split())[:-1] in |
285 |
| - ''.join(self.m.get_root().render().split())) |
286 |
| - |
287 |
| - bounds = self.m.get_bounds() |
288 |
| - assert bounds == [[[35.5636, 138.7634], [35.5629, 138.7664]], |
289 |
| - [[35.6636, 139.7634], [35.6629, 139.7664]]], bounds |
290 |
| - |
291 | 204 | def test_topo_json_smooth_factor(self):
|
292 | 205 | """Test topojson smooth factor method."""
|
293 | 206 | self.m = folium.Map([43, -100], zoom_start=4)
|
@@ -455,6 +368,7 @@ def test_global_switches(self):
|
455 | 368 | m.global_switches.no_touch is True and
|
456 | 369 | m.global_switches.disable_3d is True)
|
457 | 370 |
|
| 371 | + @pytest.mark.web |
458 | 372 | def test_json_request(self):
|
459 | 373 | """Test requests for remote GeoJSON files."""
|
460 | 374 | self.m = folium.Map(zoom_start=4)
|
|
0 commit comments