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

Method test_small_chunks

Lib/test/test_shutil.py:3319–3330  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3317 self.assertEqual(read_file(TESTFN2, binary=True), self.FILEDATA)
3318
3319 def test_small_chunks(self):
3320 # Force internal file size detection to be smaller than the
3321 # actual file size. We want to force a system call to be called
3322 # multiple times, also in order to emulate a src fd which gets
3323 # bigger while it is being copied.
3324 mock = unittest.mock.Mock()
3325 mock.st_size = 65536 + 1
3326 with unittest.mock.patch('os.fstat', return_value=mock) as m:
3327 with self.get_files() as (src, dst):
3328 self.zerocopy_fun(src, dst)
3329 assert m.called
3330 self.assertEqual(read_file(TESTFN2, binary=True), self.FILEDATA)
3331
3332 def test_big_chunk(self):
3333 # Force internal file size detection to be +100MB bigger than

Callers

nothing calls this directly

Calls 4

read_fileFunction · 0.85
get_filesMethod · 0.45
zerocopy_funMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected