summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode_file.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_unicode_file.py')
-rw-r--r--Lib/test/test_unicode_file.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py
index fd561f1..367715a 100644
--- a/Lib/test/test_unicode_file.py
+++ b/Lib/test/test_unicode_file.py
@@ -25,19 +25,19 @@ class TestUnicodeFiles(unittest.TestCase):
# Do all the tests we can given only a single filename. The file should
# exist.
def _do_single(self, filename):
- self.failUnless(os.path.exists(filename))
- self.failUnless(os.path.isfile(filename))
- self.failUnless(os.access(filename, os.R_OK))
- self.failUnless(os.path.exists(os.path.abspath(filename)))
- self.failUnless(os.path.isfile(os.path.abspath(filename)))
- self.failUnless(os.access(os.path.abspath(filename), os.R_OK))
+ self.assertTrue(os.path.exists(filename))
+ self.assertTrue(os.path.isfile(filename))
+ self.assertTrue(os.access(filename, os.R_OK))
+ self.assertTrue(os.path.exists(os.path.abspath(filename)))
+ self.assertTrue(os.path.isfile(os.path.abspath(filename)))
+ self.assertTrue(os.access(os.path.abspath(filename), os.R_OK))
os.chmod(filename, 0o777)
os.utime(filename, None)
os.utime(filename, (time.time(), time.time()))
# Copy/rename etc tests using the same filename
self._do_copyish(filename, filename)
# Filename should appear in glob output
- self.failUnless(
+ self.assertTrue(
os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0]))
# basename should appear in listdir.
path, base = os.path.split(os.path.abspath(filename))
@@ -47,7 +47,7 @@ class TestUnicodeFiles(unittest.TestCase):
base = unicodedata.normalize("NFD", base)
file_list = [unicodedata.normalize("NFD", f) for f in file_list]
- self.failUnless(base in file_list)
+ self.assertTrue(base in file_list)
# Do as many "equivalancy' tests as we can - ie, check that although we
# have different types for the filename, they refer to the same file.
@@ -55,12 +55,12 @@ class TestUnicodeFiles(unittest.TestCase):
# Note we only check "filename1 against filename2" - we don't bother
# checking "filename2 against 1", as we assume we are called again with
# the args reversed.
- self.failUnless(type(filename1)!=type(filename2),
+ self.assertTrue(type(filename1)!=type(filename2),
"No point checking equivalent filenames of the same type")
# stat and lstat should return the same results.
- self.failUnlessEqual(os.stat(filename1),
+ self.assertEqual(os.stat(filename1),
os.stat(filename2))
- self.failUnlessEqual(os.lstat(filename1),
+ self.assertEqual(os.lstat(filename1),
os.lstat(filename2))
# Copy/rename etc tests using equivalent filename
self._do_copyish(filename1, filename2)
@@ -68,19 +68,19 @@ class TestUnicodeFiles(unittest.TestCase):
# Tests that copy, move, etc one file to another.
def _do_copyish(self, filename1, filename2):
# Should be able to rename the file using either name.
- self.failUnless(os.path.isfile(filename1)) # must exist.
+ self.assertTrue(os.path.isfile(filename1)) # must exist.
os.rename(filename1, filename2 + ".new")
- self.failUnless(os.path.isfile(filename1+".new"))
+ self.assertTrue(os.path.isfile(filename1+".new"))
os.rename(filename1 + ".new", filename2)
- self.failUnless(os.path.isfile(filename2))
+ self.assertTrue(os.path.isfile(filename2))
shutil.copy(filename1, filename2 + ".new")
os.unlink(filename1 + ".new") # remove using equiv name.
# And a couple of moves, one using each name.
shutil.move(filename1, filename2 + ".new")
- self.failUnless(not os.path.exists(filename2))
+ self.assertTrue(not os.path.exists(filename2))
shutil.move(filename1 + ".new", filename2)
- self.failUnless(os.path.exists(filename1))
+ self.assertTrue(os.path.exists(filename1))
# Note - due to the implementation of shutil.move,
# it tries a rename first. This only fails on Windows when on
# different file systems - and this test can't ensure that.
@@ -107,7 +107,7 @@ class TestUnicodeFiles(unittest.TestCase):
cwd_result = unicodedata.normalize("NFD", cwd_result)
name_result = unicodedata.normalize("NFD", name_result)
- self.failUnlessEqual(os.path.basename(cwd_result),name_result)
+ self.assertEqual(os.path.basename(cwd_result),name_result)
finally:
os.chdir(cwd)
finally:
@@ -123,7 +123,7 @@ class TestUnicodeFiles(unittest.TestCase):
self._do_single(filename)
finally:
os.unlink(filename)
- self.failUnless(not os.path.exists(filename))
+ self.assertTrue(not os.path.exists(filename))
# and again with os.open.
f = os.open(filename, os.O_CREAT)
os.close(f)
@@ -134,7 +134,7 @@ class TestUnicodeFiles(unittest.TestCase):
def _test_equivalent(self, filename1, filename2):
remove_if_exists(filename1)
- self.failUnless(not os.path.exists(filename2))
+ self.assertTrue(not os.path.exists(filename2))
f = file(filename1, "w")
f.close()
try: