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

Method bug801631

Lib/test/test_fileio.py:666–687  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

664
665 def testTruncateOnWindows(self):
666 def bug801631():
667 # SF bug <https://bugs.python.org/issue801631>
668 # "file.truncate fault on windows"
669 f = self.FileIO(TESTFN, 'w')
670 f.write(bytes(range(11)))
671 f.close()
672
673 f = self.FileIO(TESTFN,'r+')
674 data = f.read(5)
675 if data != bytes(range(5)):
676 self.fail("Read on file opened for update failed %r" % data)
677 if f.tell() != 5:
678 self.fail("File pos after read wrong %d" % f.tell())
679
680 f.truncate()
681 if f.tell() != 5:
682 self.fail("File pos after ftruncate wrong %d" % f.tell())
683
684 f.close()
685 size = os.path.getsize(TESTFN)
686 if size != 5:
687 self.fail("File size after ftruncate wrong %d" % size)
688
689 try:
690 bug801631()

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
closeMethod · 0.95
readMethod · 0.95
tellMethod · 0.95
truncateMethod · 0.95
failMethod · 0.45

Tested by

no test coverage detected