Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Lib/test/test_os/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,24 @@ def test_rename(self):
new = sys.getrefcount(path)
self.assertEqual(old, new)

def test_renames(self):
old_path = os_helper.TESTFN + "old_dir"
old = os.path.join(old_path, "test")
os.mkdir(old_path)
open(old, "w+b").close()
self.addCleanup(os_helper.rmdir, old_path)
self.addCleanup(os_helper.unlink, old)

new_path = os_helper.TESTFN + "new_dir"
new = os.path.join(new_path, "test")
self.addCleanup(os_helper.rmdir, new_path)
self.addCleanup(os_helper.unlink, new)

os.renames(old, new)
self.assertTrue(os.path.exists(new))
self.assertFalse(os.path.exists(old))
self.assertFalse(os.path.exists(old_path))

def test_read(self):
with open(os_helper.TESTFN, "w+b") as fobj:
fobj.write(b"spam")
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def test_sample(self):
self.assertRaises(ValueError, self.gen.sample, population, N+1)
self.assertRaises(ValueError, self.gen.sample, [], -1)
self.assertRaises(TypeError, self.gen.sample, population, 1.0)
with self.assertRaises(TypeError):
self.gen.sample(population, 1, counts = [" "] * N)

def test_sample_distribution(self):
# For the entire allowable range of 0 <= k <= N, validate that
Expand Down
Loading