1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_text_nodes.py Fri Sep 26 23:06:24 2008 +0200
1.3 @@ -0,0 +1,30 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"Test text node insertion."
1.7 +
1.8 +import libxml2dom
1.9 +
1.10 +d = libxml2dom.createDocument(None, "test", None)
1.11 +
1.12 +t1 = d.createTextNode("Hello ")
1.13 +t2 = d.createTextNode("world")
1.14 +t3 = d.createTextNode("!")
1.15 +
1.16 +t1x = d.documentElement.appendChild(t1)
1.17 +t3x = d.documentElement.appendChild(t3)
1.18 +
1.19 +print d.toString()
1.20 +assert t2.parentNode is None
1.21 +assert t1.parentNode is not None
1.22 +assert t3.parentNode is not None
1.23 +
1.24 +t2x = d.documentElement.insertBefore(t2, t3)
1.25 +
1.26 +print d.toString()
1.27 +
1.28 +l = [n.data for n in t1.parentNode.childNodes]
1.29 +
1.30 +print l
1.31 +assert len(l) == 3
1.32 +
1.33 +# vim: tabstop=4 expandtab shiftwidth=4