| OLD | NEW |
| 1 from test import support | 1 from test import support |
| 2 import unittest | 2 import unittest |
| 3 import codecs | 3 import codecs |
| 4 import sys, _testcapi, io | 4 import sys, _testcapi, io |
| 5 | 5 |
| 6 class Queue(object): | 6 class Queue(object): |
| 7 """ | 7 """ |
| 8 queue: write bytes at one end, read bytes from the other end | 8 queue: write bytes at one end, read bytes from the other end |
| 9 """ | 9 """ |
| 10 def __init__(self, buffer): | 10 def __init__(self, buffer): |
| (...skipping 603 matching lines...) | | Loading... |
| 614 "\ufeff\x00\xff\u07ff", | 614 "\ufeff\x00\xff\u07ff", |
| 615 "\ufeff\x00\xff\u07ff\u0800", | 615 "\ufeff\x00\xff\u07ff\u0800", |
| 616 "\ufeff\x00\xff\u07ff\u0800", | 616 "\ufeff\x00\xff\u07ff\u0800", |
| 617 "\ufeff\x00\xff\u07ff\u0800", | 617 "\ufeff\x00\xff\u07ff\u0800", |
| 618 "\ufeff\x00\xff\u07ff\u0800\uffff", | 618 "\ufeff\x00\xff\u07ff\u0800\uffff", |
| 619 ] | 619 ] |
| 620 ) | 620 ) |
| 621 | 621 |
| 622 def test_bug1601501(self): | 622 def test_bug1601501(self): |
| 623 # SF bug #1601501: check that the codec works with a buffer | 623 # SF bug #1601501: check that the codec works with a buffer |
| 624 str(b"\xef\xbb\xbf", "utf-8-sig") | 624 self.assertEquals(str(b"\xef\xbb\xbf", "utf-8-sig"), "") |
| 625 | 625 |
| 626 def test_bom(self): | 626 def test_bom(self): |
| 627 d = codecs.getincrementaldecoder("utf-8-sig")() | 627 d = codecs.getincrementaldecoder("utf-8-sig")() |
| 628 s = "spam" | 628 s = "spam" |
| 629 self.assertEqual(d.decode(s.encode("utf-8-sig")), s) | 629 self.assertEqual(d.decode(s.encode("utf-8-sig")), s) |
| 630 | 630 |
| 631 def test_stream_bom(self): | 631 def test_stream_bom(self): |
| 632 unistring = "ABC\u00A1\u2200XYZ" | 632 unistring = "ABC\u00A1\u2200XYZ" |
| 633 bytestring = codecs.BOM_UTF8 + b"ABC\xC2\xA1\xE2\x88\x80XYZ" | 633 bytestring = codecs.BOM_UTF8 + b"ABC\xC2\xA1\xE2\x88\x80XYZ" |
| 634 | 634 |
| (...skipping 864 matching lines...) | | Loading... |
| 1499 StreamReaderTest, | 1499 StreamReaderTest, |
| 1500 EncodedFileTest, | 1500 EncodedFileTest, |
| 1501 BasicUnicodeTest, | 1501 BasicUnicodeTest, |
| 1502 CharmapTest, | 1502 CharmapTest, |
| 1503 WithStmtTest, | 1503 WithStmtTest, |
| 1504 ) | 1504 ) |
| 1505 | 1505 |
| 1506 | 1506 |
| 1507 if __name__ == "__main__": | 1507 if __name__ == "__main__": |
| 1508 test_main() | 1508 test_main() |
| OLD | NEW |