Issue #19716: add a test that Path.touch() doesn't change a file's contents.

Patch by Kushal Das.
This commit is contained in:
Antoine Pitrou 2013-11-23 14:52:39 +01:00
parent 7e45d25ecb
commit 8b78493d4f

View file

@ -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'