          While other backends merely warn, memcached should raise for an invalid
          key.
          """
          msg = expected_warning.replace(key, cache.make_key(key))
          with self.assertRaisesMessage(InvalidCacheKey, msg):
              cache.set(key, 'value')
  
      def test_default_never_expiring_timeout(self):
          # Regression test for #22845
          with self.settings(CACHES=caches_setting_for_tests(
 
</s> remove             with self.assertWarnsMessage(CacheKeyWarning, expected_warning):
 </s> add             with self.assertWarns(CacheKeyWarning) as cm: </s> remove                 'used with memcached: %r' % key, CacheKeyWarning
 </s> add                 'used with memcached: %r' % key
        with self.assertRaises(InvalidCacheKey) as cm:
          While other backends merely warn, memcached should raise for an invalid
          key.
          """
          msg = expected_warning.replace(key, cache.make_key(key))
        with self.assertRaises(InvalidCacheKey) as cm:
              cache.set(key, 'value')
  
      def test_default_never_expiring_timeout(self):
          # Regression test for #22845
          with self.settings(CACHES=caches_setting_for_tests(
keep keep keep keep replace keep keep keep keep keep
 Fixed #31654 -- Fixed cache key validation messages. 
tests/cache/tests.py