-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-143866: Verify return value of pathlib write methods in tests #143870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
be71fed
2c25d40
8e9c767
8b1e0db
7a8dd6f
25ad87a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,11 @@ def test_write_bytes(self): | |
| self.assertRaises(TypeError, p.write_bytes, 'somestr') | ||
| self.assertEqual(self.ground.readbytes(p), b'abcdefg') | ||
|
|
||
| def test_write_bytes_return(self): | ||
| p = self.root / 'fileA' | ||
| data = b'some bytes' | ||
| self.assertEqual(len(data), p.write_bytes(data)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes i will
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fix the CI.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My push from another device isnt synced. |
||
|
|
||
| def test_write_text(self): | ||
| p = self.root / 'fileA' | ||
| p.write_text('äbcdefg', encoding='latin-1') | ||
|
|
@@ -113,6 +118,11 @@ def test_write_text_with_newlines(self): | |
| b'abcde' + os_linesep_byte + | ||
| b'fghlk' + os_linesep_byte + b'\rmnopq') | ||
|
|
||
| def test_write_text_return(self): | ||
| p = self.root / 'fileA' | ||
| data = 'some text' | ||
| self.assertEqual(len(data), p.write_text(data)) | ||
|
|
||
| def test_mkdir(self): | ||
| p = self.root / 'newdirA' | ||
| self.assertFalse(self.ground.isdir(p)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.