From 9f7866739d8412fd090ccb352992c35bd784ff60 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Mon, 14 Nov 2016 22:02:25 +0100 Subject: [PATCH] Expand the testing of invalid arguments This is not significant advantage, but it does increase coverage. And any coverage (even if not testing the logic too much) is better than no coverage. --- test/test_xattr.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_xattr.py b/test/test_xattr.py index deba056..084b831 100644 --- a/test/test_xattr.py +++ b/test/test_xattr.py @@ -423,8 +423,24 @@ class xattrTest(unittest.TestCase): xattr.set(fh, self.USER_ATTR, self.EMPTY_VAL) self.assertEqual(xattr.get(fh, self.USER_ATTR), self.EMPTY_VAL) + def testWrongCall(self): + for call in [xattr.get, + xattr.list, xattr.listxattr, + xattr.remove, xattr.removexattr, + xattr.set, xattr.setxattr, + xattr.get, xattr.getxattr]: + self.assertRaises(TypeError, call) + def testWrongType(self): self.assertRaises(TypeError, xattr.get, object(), self.USER_ATTR) + for call in [xattr.listxattr, xattr.list]: + self.assertRaises(TypeError, call, object()) + for call in [xattr.remove, xattr.removexattr, + xattr.get, xattr.getxattr]: + self.assertRaises(TypeError, call, object(), self.USER_ATTR) + for call in [xattr.set, xattr.setxattr]: + self.assertRaises(TypeError, call, object(), self.USER_ATTR, self.USER_VAL) + def testLargeAttribute(self): fh, fname = self._getfile() -- 2.39.5