          for wkt in ('POINT(5 23)', 'MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 'LINESTRING(0 0, 1 1)'):
              self.assertEqual(GEOSGeometry(wkt), fld.to_python(wkt))
          # but raises a ValidationError for any other string
          for wkt in ('POINT(5)', 'MULTI   POLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 'BLAH(0 0, 1 1)'):
              self.assertRaises(forms.ValidationError, fld.to_python, wkt)
  
      def test_field_with_text_widget(self):
          class PointForm(forms.Form):
              pt = forms.PointField(srid=4326, widget=forms.TextInput)
  
 
</s> remove         self.assertRaises(forms.ValidationError, pnt_fld.clean, 'LINESTRING(0 0, 1 1)')
 </s> add         with self.assertRaises(forms.ValidationError):
            pnt_fld.clean('LINESTRING(0 0, 1 1)') </s> remove         self.assertRaises(EmptyPage, self.check_indexes, ([], 4, 0, False), 1, None)
        self.assertRaises(EmptyPage, self.check_indexes, ([], 4, 1, False), 1, None)
        self.assertRaises(EmptyPage, self.check_indexes, ([], 4, 2, False), 1, None)
 </s> add         with self.assertRaises(EmptyPage):
            self.check_indexes(([], 4, 0, False), 1, None)
        with self.assertRaises(EmptyPage):
            self.check_indexes(([], 4, 1, False), 1, None)
        with self.assertRaises(EmptyPage):
            self.check_indexes(([], 4, 2, False), 1, None) </s> remove             self.assertRaises(ValueError, wkb_w._set_outdim, bad_outdim)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_outdim(bad_outdim) </s> remove         self.assertRaises(ImproperlyConfigured, self.client.get, '/list/authors/invalid/')
 </s> add         with self.assertRaises(ImproperlyConfigured):
            self.client.get('/list/authors/invalid/') </s> remove             self.assertRaises(ValueError, wkb_w._set_byteorder, bad_byteorder)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_byteorder(bad_byteorder)
            with self.assertRaises(forms.ValidationError):
                fld.to_python(wkt)
          for wkt in ('POINT(5 23)', 'MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 'LINESTRING(0 0, 1 1)'):
              self.assertEqual(GEOSGeometry(wkt), fld.to_python(wkt))
          # but raises a ValidationError for any other string
          for wkt in ('POINT(5)', 'MULTI   POLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 'BLAH(0 0, 1 1)'):
            with self.assertRaises(forms.ValidationError):
                fld.to_python(wkt)
  
      def test_field_with_text_widget(self):
          class PointForm(forms.Form):
              pt = forms.PointField(srid=4326, widget=forms.TextInput)
  
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/test_geoforms.py