MCPcopy Index your code
hub / github.com/python/cpython / test_incremental_surrogatepass

Method test_incremental_surrogatepass

Lib/test/test_codecs.py:438–452  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

436 before + backslashreplace + after)
437
438 def test_incremental_surrogatepass(self):
439 # Test incremental decoder for surrogatepass handler:
440 # see issue #24214
441 # High surrogate
442 data = '\uD901'.encode(self.encoding, 'surrogatepass')
443 for i in range(1, len(data)):
444 dec = codecs.getincrementaldecoder(self.encoding)('surrogatepass')
445 self.assertEqual(dec.decode(data[:i]), '')
446 self.assertEqual(dec.decode(data[i:], True), '\uD901')
447 # Low surrogate
448 data = '\uDC02'.encode(self.encoding, 'surrogatepass')
449 for i in range(1, len(data)):
450 dec = codecs.getincrementaldecoder(self.encoding)('surrogatepass')
451 self.assertEqual(dec.decode(data[:i]), '')
452 self.assertEqual(dec.decode(data[i:]), '\uDC02')
453
454
455class UTF32Test(ReadTest, unittest.TestCase):

Callers

nothing calls this directly

Calls 3

encodeMethod · 0.45
assertEqualMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected