          ug_bar.place = None
          self.assertIsNone(ug_bar.place)
  
          # Assigning None fails: Place.restaurant is null=False
          self.assertRaises(ValueError, setattr, p, 'restaurant', None)
  
          # You also can't assign an object of the wrong type here
          self.assertRaises(ValueError, setattr, p, 'restaurant', p)
  
          # Creation using keyword argument should cache the related object.
 
</s> remove         self.assertRaises(ValueError, setattr, p, 'restaurant', p)
 </s> add         with self.assertRaises(ValueError):
            setattr(p, 'restaurant', p) </s> remove             self.assertRaises(GEOSException, fg._get_ptr)
 </s> add             with self.assertRaises(GEOSException):
                fg._get_ptr() </s> remove         self.assertRaises(ValueError, Choice.objects.filter, id__gt=None)
 </s> add         with self.assertRaises(ValueError):
            Choice.objects.filter(id__gt=None) </s> remove         self.assertRaises(FieldError, Choice.objects.filter, foo__exact=None)
 </s> add         with self.assertRaises(FieldError):
            Choice.objects.filter(foo__exact=None) </s> remove         self.assertRaises(Site.DoesNotExist, Site.objects.get_current)
 </s> add         with self.assertRaises(Site.DoesNotExist):
            Site.objects.get_current()
        with self.assertRaises(ValueError):
            setattr(p, 'restaurant', None)
          ug_bar.place = None
          self.assertIsNone(ug_bar.place)
  
          # Assigning None fails: Place.restaurant is null=False
        with self.assertRaises(ValueError):
            setattr(p, 'restaurant', None)
  
          # You also can't assign an object of the wrong type here
          self.assertRaises(ValueError, setattr, p, 'restaurant', p)
  
          # Creation using keyword argument should cache the related object.
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/one_to_one/tests.py