diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-02-21 14:48:59 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-02-21 14:48:59 (GMT) |
commit | 2f6775617c11ba7f12454f1acd129bfca0557bc8 (patch) | |
tree | a6d7c162e1c87c0b0e6206d0020e91ecd0fe4311 | |
parent | 92cb4a8c6f5c8968fc96fdffbe9de5453dd5531b (diff) | |
download | cpython-2f6775617c11ba7f12454f1acd129bfca0557bc8.zip cpython-2f6775617c11ba7f12454f1acd129bfca0557bc8.tar.gz cpython-2f6775617c11ba7f12454f1acd129bfca0557bc8.tar.bz2 |
Silence UnicodeWarning in crazy unittest test.
-rw-r--r-- | Lib/test/test_unittest.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_unittest.py b/Lib/test/test_unittest.py index d3bab2a..df760a7 100644 --- a/Lib/test/test_unittest.py +++ b/Lib/test/test_unittest.py @@ -16,6 +16,7 @@ import types from copy import deepcopy from cStringIO import StringIO import pickle +import warnings ### Support code @@ -2573,10 +2574,12 @@ class Test_TestCase(TestCase, TestEquality, TestHashing): 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 = [ |