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

Method test_write_bytes

Lib/test/test_pathlib/test_write.py:66–73  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

64 self.assertRaises(ValueError, vfsopen, p, 'wb', newline='')
65
66 def test_write_bytes(self):
67 p = self.root / 'fileA'
68 data = b'abcdefg'
69 self.assertEqual(len(data), p.write_bytes(data))
70 self.assertEqual(self.ground.readbytes(p), data)
71 # Check that trying to write str does not truncate the file.
72 self.assertRaises(TypeError, p.write_bytes, 'somestr')
73 self.assertEqual(self.ground.readbytes(p), data)
74
75 def test_write_text(self):
76 p = self.root / 'fileA'

Callers

nothing calls this directly

Calls 4

assertEqualMethod · 0.45
write_bytesMethod · 0.45
readbytesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected