diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-08-19 04:43:38 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-08-19 04:43:38 (GMT) |
commit | e349bf23584eef20e0d1e1b2989d9b1430f15507 (patch) | |
tree | d698b962c27f07d0e6f1baf4fbe13fee145c60dc /Lib/test/test_unicode.py | |
parent | d3d3171da895d8cb880f23fae6be778f0ac23be7 (diff) | |
download | cpython-e349bf23584eef20e0d1e1b2989d9b1430f15507.zip cpython-e349bf23584eef20e0d1e1b2989d9b1430f15507.tar.gz cpython-e349bf23584eef20e0d1e1b2989d9b1430f15507.tar.bz2 |
bpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences starting with "+". (GH-8741)
The UTF-7 decoder now raises UnicodeDecodeError for ill-formed
sequences starting with "+" (as specified in RFC 2152).
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 3cc018c..fb7bb2d 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1630,6 +1630,10 @@ class UnicodeTest(string_tests.CommonTest, for c in set_o: self.assertEqual(c.encode('ascii').decode('utf7'), c) + with self.assertRaisesRegex(UnicodeDecodeError, + 'ill-formed sequence'): + b'+@'.decode('utf-7') + def test_codecs_utf8(self): self.assertEqual(''.encode('utf-8'), b'') self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac') |