Kaydet (Commit) 8b78493d authored tarafından Antoine Pitrou's avatar Antoine Pitrou

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

Patch by Kushal Das.
üst 7e45d25e
......@@ -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'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment