MCPcopy
hub / github.com/django/django / test_default_lat_lon

Method test_default_lat_lon

tests/gis_tests/test_geoforms.py:447–479  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

445 self.assertIn('<textarea id="id_p"', rendered)
446
447 def test_default_lat_lon(self):
448 self.assertEqual(forms.OSMWidget.default_lon, 5)
449 self.assertEqual(forms.OSMWidget.default_lat, 47)
450 self.assertEqual(forms.OSMWidget.default_zoom, 12)
451
452 class PointForm(forms.Form):
453 p = forms.PointField(
454 widget=forms.OSMWidget(
455 attrs={
456 "default_lon": 20,
457 "default_lat": 30,
458 "default_zoom": 17,
459 }
460 ),
461 )
462
463 form = PointForm()
464 rendered = form.as_p()
465
466 attrs = {
467 "base_layer": "osm",
468 "geom_type": "POINT",
469 "map_srid": 3857,
470 "display_raw": False,
471 "default_lon": 20,
472 "default_lat": 30,
473 "default_zoom": 17,
474 "required": True,
475 "id": "id_p",
476 "geom_name": "Point",
477 }
478 expected = json_script(attrs, "id_p_mapwidget_options")
479 self.assertInHTML(expected, rendered)
480
481
482class GeometryWidgetTests(SimpleTestCase):

Callers

nothing calls this directly

Calls 4

json_scriptFunction · 0.90
as_pMethod · 0.80
assertInHTMLMethod · 0.80
PointFormClass · 0.70

Tested by

no test coverage detected