]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
add more tests for get_pathinfo()
authorRamakrishnan Muthukrishnan <ram@leastauthority.com>
Wed, 12 Aug 2015 08:56:52 +0000 (14:26 +0530)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 16:56:07 +0000 (17:56 +0100)
When operating on a file, test if the "file" is not a directory
or a symlink. Likewise for directory and symlink.

src/allmydata/test/test_util.py

index a2fa3b898d5df5a20757008569c54e8155937350..7f376314aedd145b8bfc9541412c9588842c7512 100644 (file)
@@ -644,6 +644,8 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
         dirinfo = fileutil.get_pathinfo(d)
         self.failUnlessTrue(dirinfo.isdir)
         self.failUnlessTrue(dirinfo.exists)
+        self.failUnlessFalse(dirinfo.isfile)
+        self.failUnlessFalse(dirinfo.islink)
 
         # create a file under the directory
         f = os.path.join(d, "a/1.txt")
@@ -651,6 +653,8 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
         fileinfo = fileutil.get_pathinfo(f)
         self.failUnlessTrue(fileinfo.isfile)
         self.failUnlessTrue(fileinfo.exists)
+        self.failUnlessFalse(fileinfo.isdir)
+        self.failUnlessFalse(fileinfo.islink)
         self.failUnlessEqual(fileinfo.size, 10)
 
         # create a simlink under the directory a pointing to 1.txt
@@ -659,6 +663,8 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
         symlinkinfo = fileutil.get_pathinfo(slname)
         self.failUnlessTrue(symlinkinfo.islink)
         self.failUnlessTrue(symlinkinfo.exists)
+        self.failUnlessFalse(symlinkinfo.isfile)
+        self.failUnlessFalse(symlinkinfo.isdir)
 
 
 class PollMixinTests(unittest.TestCase):