mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Fix unittest.TestCase.assertDictContainsSubset so it can't die with unicode issues when constructing failure messages. Issue 7956
This commit is contained in:
parent
225a099fe5
commit
c2294dd6ba
2 changed files with 7 additions and 9 deletions
|
@ -2573,13 +2573,10 @@ class Test_TestCase(TestCase, TestEquality, TestHashing):
|
|||
with self.assertRaises(self.failureException):
|
||||
self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_crazy(self):
|
||||
one = ''.join(chr(i) for i in range(255))
|
||||
two = u'\uFFFD'
|
||||
first = {'foo': one}
|
||||
second = {'foo': two}
|
||||
self.assertDictContainsSubset(first, second)
|
||||
# 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 = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue