      def test_snap_to_grid(self):
          "Testing GeoQuerySet.snap_to_grid()."
          # Let's try and break snap_to_grid() with bad combinations of arguments.
          for bad_args in ((), range(3), range(5)):
              self.assertRaises(ValueError, Country.objects.snap_to_grid, *bad_args)
          for bad_args in (('1.0',), (1.0, None), tuple(map(six.text_type, range(4)))):
              self.assertRaises(TypeError, Country.objects.snap_to_grid, *bad_args)
  
          # Boundary for San Marino, courtesy of Bjorn Sandvik of thematicmapping.org
          # from the world borders dataset he provides.
 
</s> remove             self.assertRaises(TypeError, Country.objects.snap_to_grid, *bad_args)
 </s> add             with self.assertRaises(TypeError):
                Country.objects.snap_to_grid(*bad_args) </s> remove             self.assertRaises(ValidationError, fld.clean, bad_default)
 </s> add             with self.assertRaises(ValidationError):
                fld.clean(bad_default) </s> remove             self.assertRaises(ValueError, wkb_w._set_byteorder, bad_byteorder)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_byteorder(bad_byteorder) </s> remove             self.assertRaises(TypeError, wkb_r.read, bad_wkb)
 </s> add             with self.assertRaises(TypeError):
                wkb_r.read(bad_wkb) </s> remove             self.assertRaises(ValueError, wkb_w._set_outdim, bad_outdim)
 </s> add             with self.assertRaises(ValueError):
                wkb_w._set_outdim(bad_outdim)
            with self.assertRaises(ValueError):
                Country.objects.snap_to_grid(*bad_args)
      def test_snap_to_grid(self):
          "Testing GeoQuerySet.snap_to_grid()."
          # Let's try and break snap_to_grid() with bad combinations of arguments.
          for bad_args in ((), range(3), range(5)):
            with self.assertRaises(ValueError):
                Country.objects.snap_to_grid(*bad_args)
          for bad_args in (('1.0',), (1.0, None), tuple(map(six.text_type, range(4)))):
              self.assertRaises(TypeError, Country.objects.snap_to_grid, *bad_args)
  
          # Boundary for San Marino, courtesy of Bjorn Sandvik of thematicmapping.org
          # from the world borders dataset he provides.
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/geoapp/tests.py