MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_incremental_surrogatepass

Method test_incremental_surrogatepass

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 4

lenFunction · 0.85
encodeMethod · 0.45
assertEqualMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected