              self.assertEqual(d.mm, 1000.0)
  
      def testInitInvalid(self):
          "Testing initialization from invalid units"
          self.assertRaises(AttributeError, D, banana=100)
  
      def testAccess(self):
          "Testing access in different units"
          d = D(m=100)
          self.assertEqual(d.km, 0.1)
 
</s> remove         self.assertRaises(AttributeError, A, banana=100)
 </s> add         with self.assertRaises(AttributeError):
            A(banana=100) </s> remove             self.assertRaises(ValidationError, fld.clean, bad_default)
 </s> add             with self.assertRaises(ValidationError):
                fld.clean(bad_default) </s> remove             self.assertRaises(NotImplementedError, Country.objects.all().geojson, field_name='mpoly')
 </s> add             with self.assertRaises(NotImplementedError):
                Country.objects.all().geojson(field_name='mpoly') </s> remove         self.assertRaises(TypeError, GEOSGeometry, None)
 </s> add         with self.assertRaises(TypeError):
            GEOSGeometry(None) </s> remove             self.assertRaises(TypeError, State.objects.reverse_geom)
 </s> add             with self.assertRaises(TypeError):
                State.objects.reverse_geom()
        with self.assertRaises(AttributeError):
            D(banana=100)
              self.assertEqual(d.mm, 1000.0)
  
      def testInitInvalid(self):
          "Testing initialization from invalid units"
        with self.assertRaises(AttributeError):
            D(banana=100)
  
      def testAccess(self):
          "Testing access in different units"
          d = D(m=100)
          self.assertEqual(d.km, 0.1)
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/gis_tests/test_measure.py