mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
convert old fail* assertions to assert*
This commit is contained in:
parent
98d23f2e06
commit
c9c0f201fe
275 changed files with 4540 additions and 4540 deletions
|
@ -20,7 +20,7 @@ class FileTests(unittest.TestCase):
|
|||
def test_access(self):
|
||||
f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
|
||||
os.close(f)
|
||||
self.assert_(os.access(support.TESTFN, os.W_OK))
|
||||
self.assertTrue(os.access(support.TESTFN, os.W_OK))
|
||||
|
||||
def test_closerange(self):
|
||||
first = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
|
||||
|
@ -85,7 +85,7 @@ class TemporaryFileTests(unittest.TestCase):
|
|||
|
||||
def check_tempfile(self, name):
|
||||
# make sure it doesn't already exist:
|
||||
self.failIf(os.path.exists(name),
|
||||
self.assertFalse(os.path.exists(name),
|
||||
"file already exists for temporary file")
|
||||
# make sure we can create the file
|
||||
open(name, "w")
|
||||
|
@ -102,7 +102,7 @@ class TemporaryFileTests(unittest.TestCase):
|
|||
self.check_tempfile(name)
|
||||
|
||||
name = os.tempnam(support.TESTFN, "pfx")
|
||||
self.assert_(os.path.basename(name)[:3] == "pfx")
|
||||
self.assertTrue(os.path.basename(name)[:3] == "pfx")
|
||||
self.check_tempfile(name)
|
||||
|
||||
def test_tmpfile(self):
|
||||
|
@ -151,7 +151,7 @@ class TemporaryFileTests(unittest.TestCase):
|
|||
fp.seek(0,0)
|
||||
s = fp.read()
|
||||
fp.close()
|
||||
self.assert_(s == "foobar")
|
||||
self.assertTrue(s == "foobar")
|
||||
|
||||
def test_tmpnam(self):
|
||||
import sys
|
||||
|
@ -176,7 +176,7 @@ class TemporaryFileTests(unittest.TestCase):
|
|||
# the root of the current drive. That's a terrible place to
|
||||
# put temp files, and, depending on privileges, the user
|
||||
# may not even be able to open a file in the root directory.
|
||||
self.failIf(os.path.exists(name),
|
||||
self.assertFalse(os.path.exists(name),
|
||||
"file already exists for temporary file")
|
||||
else:
|
||||
self.check_tempfile(name)
|
||||
|
@ -228,7 +228,7 @@ class StatAttributeTests(unittest.TestCase):
|
|||
def trunc(x): return x
|
||||
self.assertEquals(trunc(getattr(result, attr)),
|
||||
result[getattr(stat, name)])
|
||||
self.assert_(attr in members)
|
||||
self.assertTrue(attr in members)
|
||||
|
||||
try:
|
||||
result[200]
|
||||
|
@ -520,7 +520,7 @@ class MakedirTests(unittest.TestCase):
|
|||
os.makedirs(path)
|
||||
|
||||
# Try paths with a '.' in them
|
||||
self.failUnlessRaises(OSError, os.makedirs, os.curdir)
|
||||
self.assertRaises(OSError, os.makedirs, os.curdir)
|
||||
path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', os.curdir)
|
||||
os.makedirs(path)
|
||||
path = os.path.join(base, 'dir1', os.curdir, 'dir2', 'dir3', 'dir4',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue