mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-20 16:43:05 +03:00
fixed another couple of xmlreader bugs reported by Stphane Bidoul and
* xmlreader.c python/tests/reader.py: fixed another couple of xmlreader bugs reported by Stphane Bidoul and added tests. Daniel
This commit is contained in:
@ -305,15 +305,15 @@ def tst_reader(s):
|
||||
reader.Depth())
|
||||
if reader.NodeType() == 1: # Element
|
||||
while reader.MoveToNextAttribute():
|
||||
res = res + "-- %s (%s) [%s] %d\n" % (reader.NodeType(),
|
||||
reader.Name(),reader.Value(),
|
||||
reader.Depth())
|
||||
res = res + "-- %s (%s) [%s] %d %d\n" % (reader.NodeType(),
|
||||
reader.Name(),reader.Value(),
|
||||
reader.IsEmptyElement(), reader.Depth())
|
||||
return res
|
||||
|
||||
doc="""<a><b b1="b1"/><c>content of c</c></a>"""
|
||||
expect="""1 (a) [None] 0 0
|
||||
1 (b) [None] 1 1
|
||||
-- 2 (b1) [b1] 2
|
||||
-- 2 (b1) [b1] 0 2
|
||||
1 (c) [None] 0 1
|
||||
3 (#text) [content of c] 0 2
|
||||
15 (c) [None] 0 1
|
||||
@ -353,6 +353,30 @@ if res != expect:
|
||||
print res
|
||||
sys.exit(1)
|
||||
|
||||
doc="""<test a="a"/>"""
|
||||
expect="""1 (test) [None] 1 0
|
||||
-- 2 (a) [a] 0 1
|
||||
"""
|
||||
res = tst_reader(doc)
|
||||
if res != expect:
|
||||
print "test11 failed"
|
||||
print res
|
||||
sys.exit(1)
|
||||
|
||||
doc="""<test><a>aaa</a><b/></test>"""
|
||||
expect="""1 (test) [None] 0 0
|
||||
1 (a) [None] 0 1
|
||||
3 (#text) [aaa] 0 2
|
||||
15 (a) [None] 0 1
|
||||
1 (b) [None] 1 1
|
||||
15 (test) [None] 0 0
|
||||
"""
|
||||
res = tst_reader(doc)
|
||||
if res != expect:
|
||||
print "test12 failed"
|
||||
print res
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# cleanup for memory allocation counting
|
||||
#
|
||||
|
Reference in New Issue
Block a user