          # When all site objects are deleted the cache should also
          # be cleared and get_current() should raise a DoesNotExist.
          self.assertIsInstance(Site.objects.get_current(), Site)
          Site.objects.all().delete()
          self.assertRaises(Site.DoesNotExist, Site.objects.get_current)
  
      @override_settings(ALLOWED_HOSTS=['example.com'])
      def test_get_current_site(self):
          # Test that the correct Site object is returned
          request = HttpRequest()
 
</s> remove         self.assertRaises(ObjectDoesNotExist, Site.objects.get_current)
 </s> add         with self.assertRaises(ObjectDoesNotExist):
            Site.objects.get_current() </s> remove         self.assertRaises(ObjectDoesNotExist, get_current_site, request)
 </s> add         with self.assertRaises(ObjectDoesNotExist):
            get_current_site(request) </s> remove         self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            Sitemap().get_urls() </s> remove         self.assertRaises(ImproperlyConfigured, get_user, request)
 </s> add         with self.assertRaises(ImproperlyConfigured):
            get_user(request) </s> remove         self.assertRaises(ValueError, setattr, p, 'restaurant', None)
 </s> add         with self.assertRaises(ValueError):
            setattr(p, 'restaurant', None)
        with self.assertRaises(Site.DoesNotExist):
            Site.objects.get_current()
          # When all site objects are deleted the cache should also
          # be cleared and get_current() should raise a DoesNotExist.
          self.assertIsInstance(Site.objects.get_current(), Site)
          Site.objects.all().delete()
        with self.assertRaises(Site.DoesNotExist):
            Site.objects.get_current()
  
      @override_settings(ALLOWED_HOSTS=['example.com'])
      def test_get_current_site(self):
          # Test that the correct Site object is returned
          request = HttpRequest()
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/sites_tests/tests.py