From 1d7120b4afc48baea752ad775570b6cc695be386 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Wed, 12 Aug 2015 14:26:52 +0530 Subject: [PATCH] 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. --- src/allmydata/test/test_util.py | 6 ++++++ 1 file changed, 6 insertions(+) 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): -- 2.45.2