Skip to content

Commit

Permalink
Expand the testing of invalid arguments
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
iustin committed Nov 14, 2016
1 parent 90f3a2b commit 9f78667
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test_xattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,24 @@ def testEmptyValue(self):
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()
Expand Down

0 comments on commit 9f78667

Please sign in to comment.