mirror of https://github.com/python/cpython
Silence UnicodeWarning in crazy unittest test.
This commit is contained in:
parent
92cb4a8c6f
commit
2f6775617c
|
@ -16,6 +16,7 @@ import types
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import pickle
|
import pickle
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
### Support code
|
### Support code
|
||||||
|
@ -2573,10 +2574,12 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
|
||||||
with self.assertRaises(self.failureException):
|
with self.assertRaises(self.failureException):
|
||||||
self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
|
self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
|
||||||
|
|
||||||
one = ''.join(chr(i) for i in range(255))
|
with warnings.catch_warnings(record=True):
|
||||||
# this used to cause a UnicodeDecodeError constructing the failure msg
|
# silence the UnicodeWarning
|
||||||
with self.assertRaises(self.failureException):
|
one = ''.join(chr(i) for i in range(255))
|
||||||
self.assertDictContainsSubset({'foo': one}, {'foo': u'\uFFFD'})
|
# 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):
|
def testAssertEqual(self):
|
||||||
equal_pairs = [
|
equal_pairs = [
|
||||||
|
|
Loading…
Reference in New Issue