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

Method test_seek

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

Source from the content-addressed store, hash-verified

2275 "encoding=%r" % encoding)
2276
2277 def test_seek(self):
2278 # all codecs should be able to encode these
2279 s = "%s\n%s\n" % (100*"abc123", 100*"def456")
2280 for encoding in all_unicode_encodings:
2281 if encoding == "idna": # FIXME: See SF bug #1163178
2282 continue
2283 if encoding in broken_unicode_with_stateful:
2284 continue
2285 reader = codecs.getreader(encoding)(io.BytesIO(s.encode(encoding)))
2286 for t in range(5):
2287 # Test that calling seek resets the internal codec state and buffers
2288 reader.seek(0, 0)
2289 data = reader.read()
2290 self.assertEqual(s, data)
2291
2292 def test_bad_decode_args(self):
2293 for encoding in all_unicode_encodings:

Callers

nothing calls this directly

Calls 5

getreaderMethod · 0.80
encodeMethod · 0.45
seekMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected