()
| 340 | |
| 341 | |
| 342 | def test_mulyipolyline(): |
| 343 | m = Map() |
| 344 | |
| 345 | locations = [ |
| 346 | [[45.51, -122.68], [37.77, -122.43], [34.04, -118.2]], |
| 347 | [[40.78, -73.91], [41.83, -87.62], [32.76, -96.72]], |
| 348 | ] |
| 349 | |
| 350 | multipolyline = PolyLine(locations=locations, popup="MultiPolyLine") |
| 351 | multipolyline.add_to(m) |
| 352 | |
| 353 | expected_options = { |
| 354 | "smoothFactor": 1.0, |
| 355 | "noClip": False, |
| 356 | "bubblingMouseEvents": True, |
| 357 | "color": "#3388ff", |
| 358 | "dashArray": None, |
| 359 | "dashOffset": None, |
| 360 | "fill": False, |
| 361 | "fillColor": "#3388ff", |
| 362 | "fillOpacity": 0.2, |
| 363 | "fillRule": "evenodd", |
| 364 | "lineCap": "round", |
| 365 | "lineJoin": "round", |
| 366 | "opacity": 1.0, |
| 367 | "stroke": True, |
| 368 | "weight": 3, |
| 369 | } |
| 370 | |
| 371 | m._repr_html_() |
| 372 | expected_rendered = f""" |
| 373 | var {multipolyline.get_name()} = L.polyline( |
| 374 | {locations}, |
| 375 | {{ |
| 376 | "bubblingMouseEvents": true, |
| 377 | "color": "#3388ff", |
| 378 | "dashArray": null, |
| 379 | "dashOffset": null, |
| 380 | "fill": false, |
| 381 | "fillColor": "#3388ff", |
| 382 | "fillOpacity": 0.2, |
| 383 | "fillRule": "evenodd", |
| 384 | "lineCap": "round", |
| 385 | "lineJoin": "round", |
| 386 | "noClip": false, |
| 387 | "opacity": 1.0, |
| 388 | "smoothFactor": 1.0, |
| 389 | "stroke": true, |
| 390 | "weight": 3 |
| 391 | }} |
| 392 | ) |
| 393 | .addTo({m.get_name()}); |
| 394 | """ |
| 395 | |
| 396 | rendered = multipolyline._template.module.script(multipolyline) |
| 397 | assert normalize(rendered) == normalize(expected_rendered) |
| 398 | assert multipolyline.get_bounds() == get_bounds(locations) |
| 399 | assert json.dumps(multipolyline.to_dict()) == multipolyline.to_json() |
nothing calls this directly
no test coverage detected