summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorhui shang <shangdahao@gmail.com>2019-09-11 13:26:49 (GMT)
committerJason R. Coombs <jaraco@jaraco.com>2019-09-11 13:26:49 (GMT)
commit088a09af4bdeff52b9dedeb7acd1e82069f37d98 (patch)
tree26aaebe83ddd99faa504ca67e8a97c1b8e4d5263 /Lib/test/test_pathlib.py
parentf9b5840fb4497a9e2ba2c1f01ad0dafba04c8496 (diff)
downloadcpython-088a09af4bdeff52b9dedeb7acd1e82069f37d98.zip
cpython-088a09af4bdeff52b9dedeb7acd1e82069f37d98.tar.gz
cpython-088a09af4bdeff52b9dedeb7acd1e82069f37d98.tar.bz2
bpo-31163: Added return values to pathlib.Path instance's rename and replace methods. (GH-13582)
* bpo-31163: Added return values to pathlib.Path instance's rename and replace methods.
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 34c66f3..f3b385f 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1767,12 +1767,14 @@ class _BasePathTest(object):
size = p.stat().st_size
# Renaming to another path.
q = P / 'dirA' / 'fileAA'
- p.rename(q)
+ renamed_p = p.rename(q)
+ self.assertEqual(renamed_p, q)
self.assertEqual(q.stat().st_size, size)
self.assertFileNotFound(p.stat)
# Renaming to a str of a relative path.
r = rel_join('fileAAA')
- q.rename(r)
+ renamed_q = q.rename(r)
+ self.assertEqual(renamed_q, self.cls(r))
self.assertEqual(os.stat(r).st_size, size)
self.assertFileNotFound(q.stat)
@@ -1782,12 +1784,14 @@ class _BasePathTest(object):
size = p.stat().st_size
# Replacing a non-existing path.
q = P / 'dirA' / 'fileAA'
- p.replace(q)
+ replaced_p = p.replace(q)
+ self.assertEqual(replaced_p, q)
self.assertEqual(q.stat().st_size, size)
self.assertFileNotFound(p.stat)
# Replacing another (existing) path.
r = rel_join('dirB', 'fileB')
- q.replace(r)
+ replaced_q = q.replace(r)
+ self.assertEqual(replaced_q, self.cls(r))
self.assertEqual(os.stat(r).st_size, size)
self.assertFileNotFound(q.stat)