MCPcopy
hub / github.com/django/django / test_widget_has_changed

Method test_widget_has_changed

tests/gis_tests/geoadmin/tests.py:40–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 )
39
40 def test_widget_has_changed(self):
41 geoadmin = self.admin_site.get_model_admin(City)
42 form = geoadmin.get_changelist_form(None)()
43 has_changed = form.fields["point"].has_changed
44
45 initial = Point(13.4197458572965953, 52.5194108501149799, srid=4326)
46 data_same = "SRID=3857;POINT(1493879.2754093995 6894592.019687599)"
47 data_almost_same = "SRID=3857;POINT(1493879.2754093990 6894592.019687590)"
48 data_changed = "SRID=3857;POINT(1493884.0527237 6894593.8111804)"
49
50 self.assertIs(has_changed(None, data_changed), True)
51 self.assertIs(has_changed(initial, ""), True)
52 self.assertIs(has_changed(None, ""), False)
53 self.assertIs(has_changed(initial, data_same), False)
54 self.assertIs(has_changed(initial, data_almost_same), False)
55 self.assertIs(has_changed(initial, data_changed), True)
56
57
58class GISAdminTests(GeoAdminTest):

Callers

nothing calls this directly

Calls 3

PointClass · 0.90
get_model_adminMethod · 0.80
get_changelist_formMethod · 0.80

Tested by

no test coverage detected