From 12c2270abfd44cbdf730248b5f9b4196a65ba68f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@k1024.org>
Date: Mon, 25 Nov 2019 05:19:32 +0100
Subject: [PATCH] Run name tests as (encoded) bytes too

---
 test/test_xattr.py | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/test/test_xattr.py b/test/test_xattr.py
index cf7c021..2a8a634 100644
--- a/test/test_xattr.py
+++ b/test/test_xattr.py
@@ -100,27 +100,48 @@ def get_valid_symlink(path):
 def get_dangling_symlink(path):
     return get_symlink(path, dangling=True)[1]
 
+def as_bytes(call):
+    def f(path):
+        return call(path).encode()
+    return f
+
 # Note: user attributes are only allowed on files and directories, so
 # we have to skip the symlinks here. See xattr(7).
 ITEMS_P = [
     (get_file_name, False),
+    (as_bytes(get_file_name), False),
     (get_file_fd, False),
     (get_file_object, False),
     (get_dir, False),
+    (as_bytes(get_dir), False),
     (get_valid_symlink, False),
+    (as_bytes(get_valid_symlink), False),
 ]
 
 ITEMS_D = [
     "file name",
+    "file name (bytes)",
     "file FD",
     "file object",
     "directory",
+    "directory (bytes)",
     "file via symlink",
+    "file via symlink (bytes)",
+]
+
+ALL_ITEMS_P = ITEMS_P + [
+    (get_valid_symlink, True),
+    (as_bytes(get_valid_symlink), True),
+    (get_dangling_symlink, True),
+    (as_bytes(get_dangling_symlink), True),
 ]
 
-ALL_ITEMS_P = ITEMS_P + [ (get_valid_symlink, True),
-                          (get_dangling_symlink, True)]
-ALL_ITEMS_D = ITEMS_D + ["valid symlink", "dangling symlink"]
+ALL_ITEMS_D = ITEMS_D + [
+    "valid symlink",
+    "valid symlink (bytes)",
+    "dangling symlink",
+    "dangling symlink (bytes)"
+]
 
 @pytest.fixture(params=ITEMS_P, ids=ITEMS_D)
 def subject(testdir, request):
-- 
2.39.5