summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-03-18 22:29:52 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-03-18 22:29:52 (GMT)
commit689a55809818a846d2733241642572840d20570b (patch)
tree3df23660fca4efa2d5833188fbc26ac6ee25bdc2 /Lib/test
parent8c8042734aa4500db9072ef56548b544d881b5b1 (diff)
downloadcpython-689a55809818a846d2733241642572840d20570b.zip
cpython-689a55809818a846d2733241642572840d20570b.tar.gz
cpython-689a55809818a846d2733241642572840d20570b.tar.bz2
in tokenize.detect_encoding(), return utf-8-sig when a BOM is found
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_tokenize.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 7b91ab2..1bfac40 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -726,7 +726,7 @@ class TestDetectEncoding(TestCase):
b'do_something(else)\n'
)
encoding, consumed_lines = detect_encoding(self.get_readline(lines))
- self.assertEquals(encoding, 'utf-8')
+ self.assertEquals(encoding, 'utf-8-sig')
self.assertEquals(consumed_lines,
[b'# something\n', b'print(something)\n'])
@@ -747,7 +747,7 @@ class TestDetectEncoding(TestCase):
b'do_something(else)\n'
)
encoding, consumed_lines = detect_encoding(self.get_readline(lines))
- self.assertEquals(encoding, 'utf-8')
+ self.assertEquals(encoding, 'utf-8-sig')
self.assertEquals(consumed_lines, [b'# coding=utf-8\n'])
def test_mismatched_bom_and_cookie_first_line_raises_syntaxerror(self):
@@ -779,7 +779,7 @@ class TestDetectEncoding(TestCase):
b'do_something(else)\n'
)
encoding, consumed_lines = detect_encoding(self.get_readline(lines))
- self.assertEquals(encoding, 'utf-8')
+ self.assertEquals(encoding, 'utf-8-sig')
self.assertEquals(consumed_lines,
[b'#! something\n', b'f# coding=utf-8\n'])
@@ -833,12 +833,12 @@ class TestDetectEncoding(TestCase):
readline = self.get_readline((b'\xef\xbb\xbfprint(something)\n',))
encoding, consumed_lines = detect_encoding(readline)
- self.assertEquals(encoding, 'utf-8')
+ self.assertEquals(encoding, 'utf-8-sig')
self.assertEquals(consumed_lines, [b'print(something)\n'])
readline = self.get_readline((b'\xef\xbb\xbf',))
encoding, consumed_lines = detect_encoding(readline)
- self.assertEquals(encoding, 'utf-8')
+ self.assertEquals(encoding, 'utf-8-sig')
self.assertEquals(consumed_lines, [])
readline = self.get_readline((b'# coding: bad\n',))