raise a SyntaxError in detect_encoding() when a codec lookup fails like the builtin parser #4021

This commit is contained in:
Benjamin Peterson 2008-12-12 01:25:05 +00:00
parent e675f08e03
commit 433f32c3be
3 changed files with 25 additions and 13 deletions

View file

@ -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):