          """
          # memcached does not allow whitespace or control characters in keys
          self.assertRaises(Exception, cache.set, 'key with spaces', 'value')
          # memcached limits key length to 250
          self.assertRaises(Exception, cache.set, 'a' * 251, 'value')
  
      # Explicitly display a skipped test if no configured cache uses MemcachedCache
      @unittest.skipUnless(
          memcached_params.get('BACKEND') == 'django.core.cache.backends.memcached.MemcachedCache',
          "cache with python-memcached library not available")
 
</s> remove         self.assertRaises(Exception, cache.set, 'key with spaces', 'value')
 </s> add         with self.assertRaises(Exception):
            cache.set('key with spaces', 'value') </s> remove         self.assertRaises(Exception, cursor.executemany, query, [(1, 2, 3)])
        self.assertRaises(Exception, cursor.executemany, query, [(1,)])
 </s> add         with self.assertRaises(Exception):
            cursor.executemany(query, [(1, 2, 3)])
        with self.assertRaises(Exception):
            cursor.executemany(query, [(1,)]) </s> remove         self.assertRaises(ValidationError, site.full_clean)
 </s> add         with self.assertRaises(ValidationError):
            site.full_clean() </s> remove         self.assertRaises(ValueError, d.save)
        # ValueError: MySQL backend does not support timezone-aware datetimes.
 </s> add         # MySQL backend does not support timezone-aware datetimes.
        with self.assertRaises(ValueError):
            d.save() </s> remove         self.assertRaises(
            ItalianRestaurant.DoesNotExist,
            lambda: Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
        )
 </s> add         with self.assertRaises(ItalianRestaurant.DoesNotExist):
            Place.objects.get(name="Demon Dogs").restaurant.italianrestaurant
        with self.assertRaises(Exception):
            cache.set('a' * 251, 'value')
          """
          # memcached does not allow whitespace or control characters in keys
          self.assertRaises(Exception, cache.set, 'key with spaces', 'value')
          # memcached limits key length to 250
        with self.assertRaises(Exception):
            cache.set('a' * 251, 'value')
  
      # Explicitly display a skipped test if no configured cache uses MemcachedCache
      @unittest.skipUnless(
          memcached_params.get('BACKEND') == 'django.core.cache.backends.memcached.MemcachedCache',
          "cache with python-memcached library not available")
keep keep keep keep replace keep keep keep keep keep
 Refs #26022 -- Used context manager version of assertRaises in tests. 
tests/cache/tests.py