Fixed tests for issue #19279.

This commit is contained in:
Serhiy Storchaka 2013-10-19 21:14:57 +03:00
parent b649ed746e
commit 0e071c967c
1 changed files with 3 additions and 4 deletions

View File

@ -840,10 +840,9 @@ class UTF7Test(ReadTest, unittest.TestCase):
(b'a+////,+IKw-b', 'a\uffff\ufffd\u20acb'), (b'a+////,+IKw-b', 'a\uffff\ufffd\u20acb'),
] ]
for raw, expected in tests: for raw, expected in tests:
with self.subTest(raw=raw): self.assertRaises(UnicodeDecodeError, codecs.utf_7_decode,
self.assertRaises(UnicodeDecodeError, codecs.utf_7_decode, raw, 'strict', True)
raw, 'strict', True) self.assertEqual(raw.decode('utf-7', 'replace'), expected)
self.assertEqual(raw.decode('utf-7', 'replace'), expected)
def test_nonbmp(self): def test_nonbmp(self):
self.assertEqual('\U000104A0'.encode(self.encoding), b'+2AHcoA-') self.assertEqual('\U000104A0'.encode(self.encoding), b'+2AHcoA-')