From: Ramakrishnan Muthukrishnan Date: Wed, 12 Aug 2015 08:56:52 +0000 (+0530) Subject: add more tests for get_pathinfo() X-Git-Url: https://git.rkrishnan.org/Site/Content/Exhibitors/pb.xhtml?a=commitdiff_plain;h=1d7120b4afc48baea752ad775570b6cc695be386;p=tahoe-lafs%2Ftahoe-lafs.git add more tests for get_pathinfo() When operating on a file, test if the "file" is not a directory or a symlink. Likewise for directory and symlink. --- diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index a2fa3b89..7f376314 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -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):