diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-12-12 01:25:05 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-12-12 01:25:05 (GMT) |
commit | 433f32c3be3b23adc4ec389ff9e78f49c7288f3d (patch) | |
tree | 569e1c182105ecf44227edfa5bd0169a6ae3e6e8 /Lib/test | |
parent | e675f08e0333aacfc37f7995ab22e436f2862e2a (diff) | |
download | cpython-433f32c3be3b23adc4ec389ff9e78f49c7288f3d.zip cpython-433f32c3be3b23adc4ec389ff9e78f49c7288f3d.tar.gz cpython-433f32c3be3b23adc4ec389ff9e78f49c7288f3d.tar.bz2 |
raise a SyntaxError in detect_encoding() when a codec lookup fails like the builtin parser #4021
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_tokenize.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index 8fbd216..75a7a80 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -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): |