mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
raise a SyntaxError in detect_encoding() when a codec lookup fails like the builtin parser #4021
This commit is contained in:
parent
e675f08e03
commit
433f32c3be
3 changed files with 25 additions and 13 deletions
|
@ -795,6 +795,8 @@ class TestDetectEncoding(TestCase):
|
|||
self.assertEquals(encoding, 'utf-8')
|
||||
self.assertEquals(consumed_lines, [])
|
||||
|
||||
readline = self.get_readline((b'# coding: bad\n',))
|
||||
self.assertRaises(SyntaxError, detect_encoding, readline)
|
||||
|
||||
class TestTokenize(TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue