1
0
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:
Claude Paroz
2012-05-03 20:18:05 +02:00
parent 10cf3c6427
commit 00c0d3c44e
5 changed files with 7 additions and 6 deletions

View File

@@ -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)