summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r--Lib/test/test_genericpath.py92
1 files changed, 46 insertions, 46 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index d912714..9d0baeb 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -1,5 +1,5 @@
import unittest
-from test import test_support
+from test import support
import os
import genericpath
@@ -27,114 +27,114 @@ class AllCommonTest(unittest.TestCase):
)
def test_getsize(self):
- f = open(test_support.TESTFN, "wb")
+ f = open(support.TESTFN, "wb")
try:
f.write(b"foo")
f.close()
- self.assertEqual(genericpath.getsize(test_support.TESTFN), 3)
+ self.assertEqual(genericpath.getsize(support.TESTFN), 3)
finally:
if not f.closed:
f.close()
- os.remove(test_support.TESTFN)
+ os.remove(support.TESTFN)
def test_time(self):
- f = open(test_support.TESTFN, "wb")
+ f = open(support.TESTFN, "wb")
try:
f.write(b"foo")
f.close()
- f = open(test_support.TESTFN, "ab")
+ f = open(support.TESTFN, "ab")
f.write(b"bar")
f.close()
- f = open(test_support.TESTFN, "rb")
+ f = open(support.TESTFN, "rb")
d = f.read()
f.close()
self.assertEqual(d, b"foobar")
self.assert_(
- genericpath.getctime(test_support.TESTFN) <=
- genericpath.getmtime(test_support.TESTFN)
+ genericpath.getctime(support.TESTFN) <=
+ genericpath.getmtime(support.TESTFN)
)
finally:
if not f.closed:
f.close()
- os.remove(test_support.TESTFN)
+ os.remove(support.TESTFN)
def test_exists(self):
- self.assertIs(genericpath.exists(test_support.TESTFN), False)
- f = open(test_support.TESTFN, "wb")
+ self.assertIs(genericpath.exists(support.TESTFN), False)
+ f = open(support.TESTFN, "wb")
try:
f.write(b"foo")
f.close()
- self.assertIs(genericpath.exists(test_support.TESTFN), True)
+ self.assertIs(genericpath.exists(support.TESTFN), True)
finally:
if not f.close():
f.close()
try:
- os.remove(test_support.TESTFN)
+ os.remove(support.TESTFN)
except os.error:
pass
self.assertRaises(TypeError, genericpath.exists)
def test_isdir(self):
- self.assertIs(genericpath.isdir(test_support.TESTFN), False)
- f = open(test_support.TESTFN, "wb")
+ self.assertIs(genericpath.isdir(support.TESTFN), False)
+ f = open(support.TESTFN, "wb")
try:
f.write(b"foo")
f.close()
- self.assertIs(genericpath.isdir(test_support.TESTFN), False)
- os.remove(test_support.TESTFN)
- os.mkdir(test_support.TESTFN)
- self.assertIs(genericpath.isdir(test_support.TESTFN), True)
- os.rmdir(test_support.TESTFN)
+ self.assertIs(genericpath.isdir(support.TESTFN), False)
+ os.remove(support.TESTFN)
+ os.mkdir(support.TESTFN)
+ self.assertIs(genericpath.isdir(support.TESTFN), True)
+ os.rmdir(support.TESTFN)
finally:
if not f.close():
f.close()
try:
- os.remove(test_support.TESTFN)
+ os.remove(support.TESTFN)
except os.error:
pass
try:
- os.rmdir(test_support.TESTFN)
+ os.rmdir(support.TESTFN)
except os.error:
pass
self.assertRaises(TypeError, genericpath.isdir)
def test_isfile(self):
- self.assertIs(genericpath.isfile(test_support.TESTFN), False)
- f = open(test_support.TESTFN, "wb")
+ self.assertIs(genericpath.isfile(support.TESTFN), False)
+ f = open(support.TESTFN, "wb")
try:
f.write(b"foo")
f.close()
- self.assertIs(genericpath.isfile(test_support.TESTFN), True)
- os.remove(test_support.TESTFN)
- os.mkdir(test_support.TESTFN)
- self.assertIs(genericpath.isfile(test_support.TESTFN), False)
- os.rmdir(test_support.TESTFN)
+ self.assertIs(genericpath.isfile(support.TESTFN), True)
+ os.remove(support.TESTFN)
+ os.mkdir(support.TESTFN)
+ self.assertIs(genericpath.isfile(support.TESTFN), False)
+ os.rmdir(support.TESTFN)
finally:
if not f.close():
f.close()
try:
- os.remove(test_support.TESTFN)
+ os.remove(support.TESTFN)
except os.error:
pass
try:
- os.rmdir(test_support.TESTFN)
+ os.rmdir(support.TESTFN)
except os.error:
pass
self.assertRaises(TypeError, genericpath.isdir)
def test_samefile(self):
- f = open(test_support.TESTFN + "1", "wb")
+ f = open(support.TESTFN + "1", "wb")
try:
f.write(b"foo")
f.close()
self.assertIs(
genericpath.samefile(
- test_support.TESTFN + "1",
- test_support.TESTFN + "1"
+ support.TESTFN + "1",
+ support.TESTFN + "1"
),
True
)
@@ -142,24 +142,24 @@ class AllCommonTest(unittest.TestCase):
# inode information and thus, that samefile() doesn't work
if hasattr(os, "symlink"):
os.symlink(
- test_support.TESTFN + "1",
- test_support.TESTFN + "2"
+ support.TESTFN + "1",
+ support.TESTFN + "2"
)
self.assertIs(
genericpath.samefile(
- test_support.TESTFN + "1",
- test_support.TESTFN + "2"
+ support.TESTFN + "1",
+ support.TESTFN + "2"
),
True
)
- os.remove(test_support.TESTFN + "2")
- f = open(test_support.TESTFN + "2", "wb")
+ os.remove(support.TESTFN + "2")
+ f = open(support.TESTFN + "2", "wb")
f.write(b"bar")
f.close()
self.assertIs(
genericpath.samefile(
- test_support.TESTFN + "1",
- test_support.TESTFN + "2"
+ support.TESTFN + "1",
+ support.TESTFN + "2"
),
False
)
@@ -167,18 +167,18 @@ class AllCommonTest(unittest.TestCase):
if not f.close():
f.close()
try:
- os.remove(test_support.TESTFN + "1")
+ os.remove(support.TESTFN + "1")
except os.error:
pass
try:
- os.remove(test_support.TESTFN + "2")
+ os.remove(support.TESTFN + "2")
except os.error:
pass
self.assertRaises(TypeError, genericpath.samefile)
def test_main():
- test_support.run_unittest(AllCommonTest)
+ support.run_unittest(AllCommonTest)
if __name__=="__main__":
test_main()