[Python-checkins] r78288 - python/trunk/Lib/test/test_unittest.py
michael.foord
python-checkins at python.org
Sun Feb 21 15:49:00 CET 2010
Author: michael.foord
Date: Sun Feb 21 15:48:59 2010
New Revision: 78288
Log:
Silence UnicodeWarning in crazy unittest test.
Modified:
python/trunk/Lib/test/test_unittest.py
Modified: python/trunk/Lib/test/test_unittest.py
==============================================================================
--- python/trunk/Lib/test/test_unittest.py (original)
+++ python/trunk/Lib/test/test_unittest.py Sun Feb 21 15:48:59 2010
@@ -16,6 +16,7 @@
from copy import deepcopy
from cStringIO import StringIO
import pickle
+import warnings
### Support code
@@ -2573,10 +2574,12 @@
with self.assertRaises(self.failureException):
self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
- one = ''.join(chr(i) for i in range(255))
- # this used to cause a UnicodeDecodeError constructing the failure msg
- with self.assertRaises(self.failureException):
- self.assertDictContainsSubset({'foo': one}, {'foo': u'\uFFFD'})
+ with warnings.catch_warnings(record=True):
+ # silence the UnicodeWarning
+ one = ''.join(chr(i) for i in range(255))
+ # this used to cause a UnicodeDecodeError constructing the failure msg
+ with self.assertRaises(self.failureException):
+ self.assertDictContainsSubset({'foo': one}, {'foo': u'\uFFFD'})
def testAssertEqual(self):
equal_pairs = [
More information about the Python-checkins
mailing list