Diff for /gpl/axl/test/test_01.py between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2011/06/08 07:09:12 version 1.1.1.2, 2012/02/17 12:50:02
Line 51  def test_01b(): Line 51  def test_01b():
     if err:      if err:
         error ("Found error: " + str (err.code) + ", message: " + err.msg)          error ("Found error: " + str (err.code) + ", message: " + err.msg)
         return False          return False
       
       info ("Test 01-b: finished document parsing, getting root node")
   
     # get root node      # get root node
     node = doc.root      node = doc.root
   
       info ("Test 01-b: checking node name..")
   
     # check node name       # check node name 
     if node.name != "document":      if node.name != "document":
         error ("Expected to find node name 'document' but found: " + node.name)          error ("Expected to find node name 'document' but found: " + node.name)
         return False          return False
   
       info ("Test 01-b: about to get first reference..")
   
     # get first child      # get first child
     node = node.first_child      node = node.first_child
    
     info ("Test 01-b: returning..")
 
     # check node name       # check node name 
     if node.name != "child1":      if node.name != "child1":
         error ("Expected to find node name 'child1' but found: " + node.name)          error ("Expected to find node name 'child1' but found: " + node.name)
Line 623  def py_test_01(): Line 631  def py_test_01():
   
     return True      return True
   
   def py_test_02():
   
       # parse content
       (doc, err) = axl.parse ("<content><load><value test='10' /></load></content>")
       if err:
           error ("Expected to find proper parse operation but found an error: " + err.msg)
           return False
   
       # get the node
       node = doc.get ("/content/load/value")
   
       node2 = axl.Node ("test")
       node2.attr ('id', "10")
   
       # do replace
       node.replace (node2)
   
       (content, size) = doc.dump ()
   
       # check value
       if content != "<?xml version='1.0' ?><content><load><test id='10' /></load></content>":
           return False
   
       # now swap two nodes
       (doc, err) = axl.parse ("<content><load><value test='10' /><value2 test='20' /></load></content>")
       if err:
           error ("Expected to find proper parse operation but found an error: " + err.msg)
           return False
   
       node  = doc.get ("/content/load/value")
       node2 = doc.get ("/content/load/value2")
   
       # disconnect node from document
       node.deattach ()
   
       # now place after
       node2.set_child_after (node)
   
       (content, size) = doc.dump ()
   
       # check value
       if content != "<?xml version='1.0' ?><content><load><value2 test='20' /><value test='10' /></load></content>":
           return False
   
       return True
   
   def py_test_03():
       # parse content
       (doc, err) = axl.parse ("<content><load><value test='10' /></load></content>")
       if err:
           error ("Expected to find proper parse operation but found an error: " + err.msg)
           return False
   
       # get the node
       node = doc.get ("/content/load/value")
   
       info ("Got root node, creating child nodes..")
   
       iterator = 0
       while iterator < 100:
           # now add content to the node
           # info ("About to create child node, iterator=" + str (iterator))
           node2 = axl.Node ("test")
           node.set_child (node2)
   
           iterator += 1
   
       return True
   
   def py_test_04_load ():
       # parse content
       (doc, err) = axl.parse ("<content><load><value test='10' /></load></content>")
       if err:
           error ("Expected to find proper parse operation but found an error: " + err.msg)
           return False
   
       # get the node
       return doc.get ("/content/load/value")
       
   def py_test_04():
       # call to get the node from a document
       node = py_test_04_load ()
   
       iterator = 0
       while iterator < 100:
           
           # check value
           if node.attr ("test") != "10":
               return False
   
           # next position
           iterator += 1
   
       return True
   
   def py_test_05 ():
       # create empty node 
       node = axl.Node ("test")
   
       # set is as child
       node.set_child (axl.Node ("test2"))
   
       # query empty
       node.child_called ("test")
       node.child_called ("test")
   
       del node
       return True
       
       
   
 ###########################  ###########################
 # intraestructure support #  # intraestructure support #
 ###########################  ###########################
Line 669  tests = [ Line 788  tests = [
     (test_05,    "Check DTD basic parsing"),      (test_05,    "Check DTD basic parsing"),
     (test_22,    "Check Axl node attributes"),      (test_22,    "Check Axl node attributes"),
     (test_33,    "Check Recursive root node replace"),      (test_33,    "Check Recursive root node replace"),
    (py_test_01, "Check PyNode type attributes"),    (py_test_01, "Check PyAxlNode type attributes"),
     (py_test_02, "Check PyAxlNode replace, deattach, set_child_after method"),
     (py_test_03, "Check PyAxlNode and PyAxlDoc relation"),
     (py_test_04, "Check PyAxlNode reference after PyAxlDoc reference finish"),
     (py_test_05, "Check PyAxlNode setting childs references crated")
 ]  ]
   
 info (" LibAxl: Another XML library (regression test).")  info (" LibAxl: Another XML library (regression test).")

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>