[4suite-checkins] In Amara/test/bindery, files mutation.py, xpath.py, xslt.py

Uche Ogbuji uogbuji at 4suite.org
Sun Nov 26 00:29:07 MST 2006


Modified Files:
    mutation.py xpath.py xslt.py

Log Message:
Fix xml_set_attribute bug
Fix XPath bug with comments/PIs and attribute axis
Touch up docs

ViewCVS diff:
  http://cvs.4suite.org/viewcvs/Amara/test/bindery/mutation.py.diff?r1=1.20&r2=1.21
ViewCVS view:
  http://cvs.4suite.org/viewcvs/Amara/test/bindery/mutation.py?rev=1.21&content-type=text/vnd.viewcvs-markup

Index: mutation.py
===================================================================
RCS file: /var/local/cvsroot/Amara/test/bindery/mutation.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -U2 -r1.20 -r1.21
--- mutation.py	31 Oct 2006 15:27:15 -0000	1.20
+++ mutation.py	26 Nov 2006 07:29:07 -0000	1.21
@@ -434,4 +434,12 @@
         return
 
+    def testSetAttribute7(self):
+        DOC = '<a><b>spam</b></a>'
+        EXPECTED = '<a foo="bar"><b>spam</b></a>'
+        doc = amara.parse(DOC)
+        doc.a.xml_set_attribute(u"foo", u"bar")
+        self.assertEqual(doc.xml(), XMLDECL+EXPECTED)
+        return
+
     def testInsertAfter1(self):
         DOC = "<a><b>spam</b></a>"
@@ -499,3 +507,2 @@
     unittest.main()
 
-
ViewCVS diff:
  http://cvs.4suite.org/viewcvs/Amara/test/bindery/xpath.py.diff?r1=1.5&r2=1.6
ViewCVS view:
  http://cvs.4suite.org/viewcvs/Amara/test/bindery/xpath.py?rev=1.6&content-type=text/vnd.viewcvs-markup

Index: xpath.py
===================================================================
RCS file: /var/local/cvsroot/Amara/test/bindery/xpath.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -U2 -r1.5 -r1.6
--- xpath.py	22 Sep 2005 13:53:51 -0000	1.5
+++ xpath.py	26 Nov 2006 07:29:07 -0000	1.6
@@ -196,4 +196,20 @@
         return
 
+    def testAttrAxis3(self):
+        #Reported by Luis Miguel Morillas
+        #http://lists.fourthought.com/pipermail/4suite/2006-November/008136.html
+        XML = '<a><!-- example --><b>blablabla</b></a>'
+        doc = amara.parse(XML)
+        self.assertEqual(len(doc.xml_xpath(u"//*")), 2)
+        self.assertEqual(len(doc.xml_xpath(u"//@*")), 0)
+        return
+
+    def testAttrAxis4(self):
+        XML = '<a><?target data?><b>blablabla</b></a>'
+        doc = amara.parse(XML)
+        self.assertEqual(len(doc.xml_xpath(u"//*")), 2)
+        self.assertEqual(len(doc.xml_xpath(u"//@*")), 0)
+        return
+
     def testAttrAxisNs(self):
         RSS10_NSS = {
ViewCVS diff:
  http://cvs.4suite.org/viewcvs/Amara/test/bindery/xslt.py.diff?r1=1.2&r2=1.3
ViewCVS view:
  http://cvs.4suite.org/viewcvs/Amara/test/bindery/xslt.py?rev=1.3&content-type=text/vnd.viewcvs-markup

Index: xslt.py
===================================================================
RCS file: /var/local/cvsroot/Amara/test/bindery/xslt.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -U2 -r1.2 -r1.3
--- xslt.py	30 Oct 2006 02:54:47 -0000	1.2
+++ xslt.py	26 Nov 2006 07:29:07 -0000	1.3
@@ -49,5 +49,5 @@
 
     def testIdentity(self):
-        if sys.hexversion < 0x2050000: return #Amara's doc order index impl is badly incomplete.  Just happens to manifest in Python 2.4
+        if sys.hexversion < 0x2050000: return #FIXME Amara's doc order index impl is badly incomplete.  Just happens to manifest in Python 2.4
         for source in [LABELS, XBEL]:
             doc = amara.parse(source)


More information about the 4suite-checkins mailing list