MCPcopy
hub / github.com/django/django / test_geography_unique

Method test_geography_unique

tests/gis_tests/geogapp/tests.py:45–55  ·  view source on GitHub ↗

Cast geography fields to geometry type when validating uniqueness to remove the reliance on unavailable ~= operator.

(self)

Source from the content-addressed store, hash-verified

43
44 @skipUnlessDBFeature("supports_geography", "supports_geometry_field_unique_index")
45 def test_geography_unique(self):
46 """
47 Cast geography fields to geometry type when validating uniqueness to
48 remove the reliance on unavailable ~= operator.
49 """
50 htown = City.objects.get(name="Houston")
51 CityUnique.objects.create(point=htown.point)
52 duplicate = CityUnique(point=htown.point)
53 msg = "City unique with this Point already exists."
54 with self.assertRaisesMessage(ValidationError, msg):
55 duplicate.validate_unique()
56
57 @skipUnlessDBFeature("supports_geography")
58 def test_operators_functions_unavailable_for_geography(self):

Callers

nothing calls this directly

Calls 5

CityUniqueClass · 0.85
assertRaisesMessageMethod · 0.80
getMethod · 0.45
createMethod · 0.45
validate_uniqueMethod · 0.45

Tested by

no test coverage detected