MCPcopy
hub / github.com/django/django / test_make_valid

Method test_make_valid

tests/gis_tests/geoapp/test_functions.py:536–549  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

534
535 @skipUnlessDBFeature("has_MakeValid_function")
536 def test_make_valid(self):
537 invalid_geom = fromstr("POLYGON((0 0, 0 1, 1 1, 1 0, 1 1, 1 0, 0 0))")
538 State.objects.create(name="invalid", poly=invalid_geom)
539 invalid = (
540 State.objects.filter(name="invalid")
541 .annotate(repaired=functions.MakeValid("poly"))
542 .first()
543 )
544 self.assertIs(invalid.repaired.valid, True)
545 self.assertTrue(
546 invalid.repaired.equals(
547 fromstr("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))", srid=invalid.poly.srid)
548 )
549 )
550
551 @skipUnlessDBFeature("has_MakeValid_function")
552 def test_make_valid_multipolygon(self):

Callers

nothing calls this directly

Calls 6

fromstrFunction · 0.90
firstMethod · 0.80
annotateMethod · 0.80
createMethod · 0.45
filterMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected