mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Made warning assertions work with or without -Wall python switch
This commit is contained in:
2
tests/regressiontests/cache/tests.py
vendored
2
tests/regressiontests/cache/tests.py
vendored
@@ -469,11 +469,13 @@ class BaseCacheTests(object):
|
||||
|
||||
try:
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
# memcached does not allow whitespace or control characters in keys
|
||||
self.cache.set('key with spaces', 'value')
|
||||
self.assertEqual(len(w), 2)
|
||||
self.assertTrue(isinstance(w[0].message, CacheKeyWarning))
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always")
|
||||
# memcached limits key length to 250
|
||||
self.cache.set('a' * 251, 'value')
|
||||
self.assertEqual(len(w), 1)
|
||||
|
||||
Reference in New Issue
Block a user