From 90f3a2b125151ad03e26f88f1860946179f73a15 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Mon, 14 Nov 2016 00:57:35 +0100 Subject: [PATCH] Test writing large values This exercises one more code path. --- test/test_xattr.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_xattr.py b/test/test_xattr.py index 4dce945..deba056 100644 --- a/test/test_xattr.py +++ b/test/test_xattr.py @@ -32,6 +32,7 @@ class xattrTest(unittest.TestCase): USER_ATTR = NS_USER.decode() + "." + USER_NN USER_VAL = "abc" EMPTY_VAL = "" + LARGE_VAL = "x" * 2048 MANYOPS_COUNT = 131072 if PY3K: @@ -39,6 +40,7 @@ class xattrTest(unittest.TestCase): USER_VAL = USER_VAL.encode() USER_ATTR = USER_ATTR.encode() EMPTY_VAL = EMPTY_VAL.encode() + LARGE_VAL = LARGE_VAL.encode() @staticmethod def _ignore_tuples(attrs): @@ -424,6 +426,12 @@ class xattrTest(unittest.TestCase): def testWrongType(self): self.assertRaises(TypeError, xattr.get, object(), self.USER_ATTR) + def testLargeAttribute(self): + fh, fname = self._getfile() + + xattr.set(fh, self.USER_ATTR, self.LARGE_VAL) + self.assertEqual(xattr.get(fh, self.USER_ATTR), self.LARGE_VAL) + if __name__ == "__main__": unittest.main() -- 2.39.5