MCPcopy
hub / github.com/django/django / test_pointfield

Method test_pointfield

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

Source from the content-addressed store, hash-verified

321 # map_srid in openlayers.html template must not be localized.
322 @override_settings(USE_THOUSAND_SEPARATOR=True)
323 def test_pointfield(self):
324 class PointForm(forms.Form):
325 p = forms.PointField()
326
327 geom = self.geometries["point"]
328 form = PointForm(data={"p": geom})
329 self.assertTextarea(geom, form.as_p())
330 self.assertMapWidget(form, "Point")
331 self.assertFalse(PointForm().is_valid())
332 invalid = PointForm(data={"p": "some invalid geom"})
333 self.assertFalse(invalid.is_valid())
334 self.assertIn("Invalid geometry value", str(invalid.errors))
335
336 for invalid in [geo for key, geo in self.geometries.items() if key != "point"]:
337 self.assertFalse(PointForm(data={"p": invalid.wkt}).is_valid())
338
339 def test_multipointfield(self):
340 class PointForm(forms.Form):

Callers

nothing calls this directly

Calls 6

assertTextareaMethod · 0.95
assertMapWidgetMethod · 0.95
as_pMethod · 0.80
PointFormClass · 0.70
is_validMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected