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

Method testAppend

Lib/test/test_fileio.py:694–710  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

692 os.unlink(TESTFN)
693
694 def testAppend(self):
695 try:
696 f = self.FileIO(TESTFN, 'wb')
697 f.write(b'spam')
698 f.close()
699 f = self.FileIO(TESTFN, 'ab')
700 f.write(b'eggs')
701 f.close()
702 f = self.FileIO(TESTFN, 'rb')
703 d = f.read()
704 f.close()
705 self.assertEqual(d, b'spameggs')
706 finally:
707 try:
708 os.unlink(TESTFN)
709 except:
710 pass
711
712 def testInvalidInit(self):
713 self.assertRaises(TypeError, self.FileIO, "1", 0, 0)

Callers

nothing calls this directly

Calls 5

writeMethod · 0.95
closeMethod · 0.95
readMethod · 0.95
assertEqualMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected