summaryrefslogtreecommitdiff
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-04-12 10:35:00 +0000
committerWalter Dörwald <walter@livinglogic.de>2007-04-12 10:35:00 +0000
commit4234827e99eb73adbd387e15619cd6290f80f655 (patch)
treeb4ab22283f7054598fc18a0f8c2168145c33a0a8 /Lib/test/test_codecs.py
parent9aba6d6905bcf3f3009f71cfa70525eb8b0ad3dc (diff)
downloadcpython-git-4234827e99eb73adbd387e15619cd6290f80f655.tar.gz
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 3c800f8777..038962345d 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -429,6 +429,11 @@ class UTF8SigTest(ReadTest):
# SF bug #1601501: check that the codec works with a buffer
unicode("\xef\xbb\xbf", "utf-8-sig")
+ def test_bom(self):
+ d = codecs.getincrementaldecoder("utf-8-sig")()
+ s = u"spam"
+ self.assertEqual(d.decode(s.encode("utf-8-sig")), s)
+
class EscapeDecodeTest(unittest.TestCase):
def test_empty(self):
self.assertEquals(codecs.escape_decode(""), ("", 0))