[Libguestfs] [PATCH 4/7] python: Add test for "special" keys and values

Hilko Bengen
Fri, 10 Jan 2014 23:12:49 -0000

---
 python/t/130-special.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100755 python/t/130-special.py

diff --git a/python/t/130-special.py b/python/t/130-special.py
new file mode 100755
index 0000000..7adb9d5
--- /dev/null
+++ b/python/t/130-special.py
@@ -0,0 +1,28 @@
+# coding: utf-8
+
+import os
+import hivex
+
+srcdir = os.environ["srcdir"]
+if not srcdir:
+    srcdir = "."
+
+h = hivex.Hivex ("%s/../images/special" % srcdir)
+assert h
+
+root = h.root ()
+assert root
+
+ns = [ n for n in h.node_children (root) if h.node_name(n) ==
u"abcd_äöüß" ]
+assert len (ns) == 1
+vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) ==
u"abcd_äöüß" ]
+assert len (vs) == 1
+ns = [ n for n in h.node_children (root) if h.node_name(n) ==
u"zero\0key" ]
+assert len (ns) == 1
+vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) ==
u"zero\0val" ]
+assert len (vs) == 1
+ns = [ n for n in h.node_children (root) if h.node_name(n) ==
u"weird™" ]
+assert len (ns) == 1
+vs = [ v for v in h.node_values (ns[0]) if h.value_key(v) == u"symbols
$£₤₧€" ]
+assert len (vs) == 1
+
--
1.8.5.2