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

Richard W.M. Jones rjones at redhat.com
Mon Jan 13 13:20:36 UTC 2014


On Sat, Jan 11, 2014 at 12:12:49AM +0100, Hilko Bengen wrote:
> ---
>  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

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)




More information about the Libguestfs mailing list