Commit 09b792ba authored by Daniel Veillard's avatar Daniel Veillard

applied patch from Malcolm Tredinnick to avoid tabs in python sources,

* python/tests/*.py: applied patch from Malcolm Tredinnick
  to avoid tabs in python sources, should fix #135095
Daniel
parent 807daf82
Mon Feb 23 11:52:12 CET 2004 Daniel Veillard <daniel@veillard.com>
* python/tests/*.py: applied patch from Malcolm Tredinnick
to avoid tabs in python sources, should fix #135095
Sun Feb 22 23:16:23 CET 2004 Daniel Veillard <daniel@veillard.com>
* testSAX.c: add --timing option
......
......@@ -36,9 +36,9 @@ if err != expect:
i = 10000
while i > 0:
try:
doc = libxml2.parseFile("missing.xml")
doc = libxml2.parseFile("missing.xml")
except libxml2.parserError:
got_exc = 1
got_exc = 1
err = ""
i = i - 1
......
......@@ -14,43 +14,43 @@ class callback:
self.starte = starte
self.ende = ende
self.endd = endd
self.delta = delta
self.count = 0
self.delta = delta
self.count = 0
def startDocument(self):
global ctxt
if ctxt.byteConsumed() != self.startd:
print "document start at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), self.startd)
if ctxt.byteConsumed() != self.startd:
print "document start at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), self.startd)
sys.exit(1)
def endDocument(self):
global ctxt
expect = self.ende + self.delta * (self.count - 1) + self.endd
if ctxt.byteConsumed() != expect:
print "document end at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), expect)
expect = self.ende + self.delta * (self.count - 1) + self.endd
if ctxt.byteConsumed() != expect:
print "document end at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), expect)
sys.exit(1)
def startElement(self, tag, attrs):
global ctxt
if tag == "bar1":
expect = self.starte + self.delta * self.count
if ctxt.byteConsumed() != expect:
print "element start at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), expect)
sys.exit(1)
if tag == "bar1":
expect = self.starte + self.delta * self.count
if ctxt.byteConsumed() != expect:
print "element start at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), expect)
sys.exit(1)
def endElement(self, tag):
global ctxt
if tag == "bar1":
expect = self.ende + self.delta * self.count
if ctxt.byteConsumed() != expect:
print "element end at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), expect)
sys.exit(1)
self.count = self.count + 1
if tag == "bar1":
expect = self.ende + self.delta * self.count
if ctxt.byteConsumed() != expect:
print "element end at wrong index: %d expecting %d\n" % (
ctxt.byteConsumed(), expect)
sys.exit(1)
self.count = self.count + 1
def characters(self, data):
pass
......
......@@ -100,9 +100,9 @@ ret = reader.Read()
while ret == 1:
if reader.Name() == "ref":
if reader.LookupNamespace("a") != "urn:456":
print "error resolving namespace prefix"
sys.exit(1)
break
print "error resolving namespace prefix"
sys.exit(1)
break
ret = reader.Read()
if ret != 1:
print "Error finding the ref element"
......@@ -301,14 +301,14 @@ def tst_reader(s):
reader = input.newTextReader("tst")
res = ""
while reader.Read():
res=res + "%s (%s) [%s] %d %d\n" % (reader.NodeType(),reader.Name(),
reader.Value(), reader.IsEmptyElement(),
reader.Depth())
if reader.NodeType() == 1: # Element
while reader.MoveToNextAttribute():
res = res + "-- %s (%s) [%s] %d %d\n" % (reader.NodeType(),
reader.Name(),reader.Value(),
reader.IsEmptyElement(), reader.Depth())
res=res + "%s (%s) [%s] %d %d\n" % (reader.NodeType(),reader.Name(),
reader.Value(), reader.IsEmptyElement(),
reader.Depth())
if reader.NodeType() == 1: # Element
while reader.MoveToNextAttribute():
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>"""
......
......@@ -15,11 +15,11 @@ def tst_reader(s):
reader = input.newTextReader("tst")
res = ""
while reader.Read():
res=res + "%s (%s) [%s] %d\n" % (reader.NodeType(),reader.Name(),
res=res + "%s (%s) [%s] %d\n" % (reader.NodeType(),reader.Name(),
reader.Value(), reader.IsEmptyElement())
if reader.NodeType() == 1: # Element
while reader.MoveToNextAttribute():
res = res + "-- %s (%s) [%s]\n" % (reader.NodeType(),
if reader.NodeType() == 1: # Element
while reader.MoveToNextAttribute():
res = res + "-- %s (%s) [%s]\n" % (reader.NodeType(),
reader.Name(),reader.Value())
return res
......
......@@ -22,10 +22,10 @@ res=""
while reader.Read():
while reader.Name() == 'bibl':
node = reader.Expand() # expand the subtree
if node.xpathEval("@id = 'Aho'"): # use XPath on it
res = res + node.serialize()
if reader.Next() != 1: # skip the subtree
break;
if node.xpathEval("@id = 'Aho'"): # use XPath on it
res = res + node.serialize()
if reader.Next() != 1: # skip the subtree
break;
if res != expect:
print "Error: didn't get the expected output"
......
......@@ -23,8 +23,8 @@ while i < 5000:
doc = libxml2.parseFile("doesnotexist.xml")
root = doc.children
if root.name != "foo":
print "root element name error"
sys.exit(1)
print "root element name error"
sys.exit(1)
doc.freeDoc()
i = i + 1
......
......@@ -37,14 +37,14 @@ while i > 0:
res = ctxt.xpathEval("foo(1)")
if res != 2:
print "xpath extension failure"
sys.exit(1)
sys.exit(1)
i = i - 1
i = 10000
while i > 0:
res = ctxt.xpathEval("bar(1)")
if res != "3":
print "xpath extension failure got %s expecting '3'"
sys.exit(1)
sys.exit(1)
i = i - 1
doc.freeDoc()
ctxt.xpathFreeContext()
......
......@@ -32,8 +32,8 @@ while i > 0:
valid = ctxt.isValid()
doc.freeDoc()
if valid != 1:
print "validity check failed"
sys.exit(1)
print "validity check failed"
sys.exit(1)
i = i - 1
#desactivate error messages from the validation
......@@ -68,8 +68,8 @@ while i > 0:
valid = ctxt.isValid()
doc.freeDoc()
if valid != 0:
print "validity check failed"
sys.exit(1)
print "validity check failed"
sys.exit(1)
i = i - 1
del ctxt
......
......@@ -28,14 +28,14 @@ while i > 0:
res = ctxt.xpathEval("foo(1)")
if res != 2:
print "xpath extension failure"
sys.exit(1)
sys.exit(1)
i = i - 1
i = 10000
while i > 0:
res = ctxt.xpathEval("bar(1)")
if res != "3":
print "xpath extension failure got %s expecting '3'"
sys.exit(1)
sys.exit(1)
i = i - 1
doc.freeDoc()
ctxt.xpathFreeContext()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment