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

Method check_state_handling_encode

Lib/test/test_codecs.py:104–112  ·  view source on GitHub ↗
(self, encoding, u, s)

Source from the content-addressed store, hash-verified

102 self.assertEqual(u, part1+part2)
103
104 def check_state_handling_encode(self, encoding, u, s):
105 for i in range(len(u)+1):
106 d = codecs.getincrementalencoder(encoding)()
107 part1 = d.encode(u[:i])
108 state = d.getstate()
109 d = codecs.getincrementalencoder(encoding)()
110 d.setstate(state)
111 part2 = d.encode(u[i:], True)
112 self.assertEqual(s, part1+part2)
113
114
115class ReadTest(MixInCheckStateHandling):

Callers 1

test_decoder_stateMethod · 0.80

Calls 4

encodeMethod · 0.45
getstateMethod · 0.45
setstateMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected