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

Method test_write_bytes

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

Source from the content-addressed store, hash-verified

58 self.assertRaises(ValueError, magic_open, p, 'wb', newline='')
59
60 def test_write_bytes(self):
61 p = self.root / 'fileA'
62 data = b'abcdefg'
63 self.assertEqual(len(data), p.write_bytes(data))
64 self.assertEqual(self.ground.readbytes(p), data)
65 # Check that trying to write str does not truncate the file.
66 self.assertRaises(TypeError, p.write_bytes, 'somestr')
67 self.assertEqual(self.ground.readbytes(p), data)
68
69 def test_write_text(self):
70 p = self.root / 'fileA'

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
assertEqualMethod · 0.45
write_bytesMethod · 0.45
readbytesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected