mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #19716: add a test that Path.touch() doesn't change a file's contents.
Patch by Kushal Das.
This commit is contained in:
parent
7e45d25ecb
commit
8b78493d4f
1 changed files with 7 additions and 0 deletions
|
@ -1403,6 +1403,13 @@ class _BasePathTest(object):
|
|||
self.assertTrue(p.exists())
|
||||
self.assertRaises(OSError, p.touch, exist_ok=False)
|
||||
|
||||
def test_touch_nochange(self):
|
||||
P = self.cls(BASE)
|
||||
p = P / 'fileA'
|
||||
p.touch()
|
||||
with p.open('rb') as f:
|
||||
self.assertEqual(f.read().strip(), b"this is file A")
|
||||
|
||||
def test_mkdir(self):
|
||||
P = self.cls(BASE)
|
||||
p = P / 'newdirA'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue