Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Lib/test/test_pathlib/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ def test_write_bytes(self):
# Check that trying to write str does not truncate the file.
self.assertRaises(TypeError, p.write_bytes, 'somestr')
self.assertEqual(self.ground.readbytes(p), b'abcdefg')
# check the return value
data = b'some bytes'
self.assertEqual(len(data), p.write_bytes(data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do the same here and move the check to the line 68?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i will

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fix the CI.


def test_write_text(self):
p = self.root / 'fileA'
p.write_text('äbcdefg', encoding='latin-1')
data = 'äbcdefg'
self.assertEqual(len(data), p.write_text(data, encoding='latin-1'))
self.assertEqual(self.ground.readbytes(p), b'\xe4bcdefg')
# Check that trying to write bytes does not truncate the file.
self.assertRaises(TypeError, p.write_text, b'somebytes', encoding='utf-8')
Expand Down
Loading