[XML-SIG] minidom changes

Mike Olson Mike.Olson@fourthought.com
25 Jul 2002 16:58:35 -0600


On Thu, 2002-07-25 at 10:18, Fred L. Drake, Jr. wrote:
> 
> Mike Olson writes:
>  > I'm going to check in my minidom changes so that 0.8 mostly works with
>  > XPath and Xslt (I'll explain more latter).  I have a question first. 
> 
> The tests fail for me for Python versions 2.0.1, 2.1.3, 2.2.1, and
> 2.3a0 (CVS).  This is with a completely fresh build of PyXML.

Sorry, I didn;t run these tests before I checked in, i didn't even think
to do it.

The problem is that the element that the test is cloning does not have
an owner document.  So the question is, is that an error with the clone
node code (ie should that be allowed) or is it a problem with the test
harness (as all nodes should have an owner document).  I can fix it
either way.  I think it is a problem with the test harness.  

However, I think we say it is OK to do xml.dom.minidom.Element('e')
inwhich case we could have a lot of nodes without owner documents and a
lot of people will get these errors.

Mike

> 
> Here's the output of "make check":
> 
> ------------------------------------------------------------------------
> python2.0 setup.py  -q build
> python2.1 setup.py  -q build
> python2.2 setup.py  -q build
> python2.3 setup.py  -q build
> cd test && PYTHONPATH=../build/lib.linux-i686-2.0 python2.0 testxml.py
> Traceback (most recent call last):
>   File "test_minidom.py", line 773, in ?
>     func()
>   File "test_minidom.py", line 534, in testUserData
>     c = n.cloneNode(1)
>   File "/home/fdrake/projects/pyxml/xml/build/lib.linux-i686-2.0/_xmlplus/dom/minidom.py", line 186, in cloneNode
>     clone = CloneNode(self,deep,self.ownerDocument or self)
>   File "/home/fdrake/projects/pyxml/xml/build/lib.linux-i686-2.0/_xmlplus/dom/minidom.py", line 1221, in CloneNode
>     clone = newOwnerDocument.createElementNS(node.namespaceURI,
>   File "/home/fdrake/projects/pyxml/xml/build/lib.linux-i686-2.0/_xmlplus/dom/minicompat.py", line 134, in __getattr__
>     raise AttributeError, key
> AttributeError: createElementNS
> test_c14n
> test_dom
> test_encodings
> test_filter
> test_howto
> test_htmlb
> test_javadom
> test_marshal
> test test_marshal failed -- Writing: "[None, 1, 10301051460877537453973547267843L, {2: 'eggs', 1: 'spam'}, '<fake tag>', (1+5j), [...]]", expected: "[None, 1, 10301051460877537453973547267843L, {1: 'spam', 2: 'eggs'}, '<fake tag>', (1+5j), [...]]"
> test_minidom
> test test_minidom failed -- Writing: 'Test Failed: testUserData\012createElementNS\012', expected: ''
> test_pyexpat
> test_pyxmldom
> Warning: can't open ./output/test_pyxmldom
> test_sax
> test_sax2
> test_sax2_xmlproc
> test_sax_xmlproc
> test_saxdrivers
> test_utils
> test_xmlbuilder
> test_xmlproc
> 17 tests OK.
> 2 tests failed: test_marshal test_minidom
> cd test && PYTHONPATH=../build/lib.linux-i686-2.1 python2.1 testxml.py
> Traceback (most recent call last):
>   File "test_minidom.py", line 773, in ?
>     func()
>   File "test_minidom.py", line 534, in testUserData
>     c = n.cloneNode(1)
>   File "/home/fdrake/projects/pyxml/xml/build/lib.linux-i686-2.1/_xmlplus/dom/minidom.py", line 186, in cloneNode
>     clone = CloneNode(self,deep,self.ownerDocument or self)
>   File "/home/fdrake/projects/pyxml/xml/build/lib.linux-i686-2.1/_xmlplus/dom/minidom.py", line 1221, in CloneNode
>     clone = newOwnerDocument.createElementNS(node.namespaceURI,
>   File "/home/fdrake/projects/pyxml/xml/build/lib.linux-i686-2.1/_xmlplus/dom/minicompat.py", line 134, in __getattr__
>     raise AttributeError, key
> AttributeError: createElementNS
> test_c14n
> test_dom
> test_encodings
> test_filter
> test_howto
> test_htmlb
> test_javadom
> test_marshal
> test test_marshal failed -- Writing: "[None, 1, 10301051460877537453973547267843L, {2: 'eggs', 1: 'spam'}, '<fake tag>', (1+5j), [...]]", expected: "[None, 1, 10301051460877537453973547267843L, {1: 'spam', 2: 'eggs'}, '<fake tag>', (1+5j), [...]]"
> test_minidom
> test test_minidom failed -- Writing: 'Test Failed: testUserData\ncreateElementNS\n', expected: ''
> test_pyexpat
> test_pyxmldom
> Warning: can't open ./output/test_pyxmldom
> test_sax
> test_sax2
> test_sax2_xmlproc
> test_sax_xmlproc
> test_saxdrivers
> test_utils
> test_xmlbuilder
> test_xmlproc
> 17 tests OK.
> 2 tests failed: test_marshal test_minidom
> cd test && PYTHONPATH=../build/lib.linux-i686-2.2 python2.2 testxml.py
> Traceback (most recent call last):
>   File "test_minidom.py", line 773, in ?
>     func()
>   File "test_minidom.py", line 247, in testGetElementsByTagNameNS
>     confirm(len(elem) == 1)
>   File "test_minidom.py", line 25, in confirm
>     print "Failed " + testname
>   File "regrtest.py", line 205, in write
>     raise test_support.TestFailed, \
> TestFailed: Writing: 'Failed Test', expected: ''
> test_c14n
> test_dom
> test_encodings
> test_filter
> test_howto
> test_htmlb
> test_javadom
> test_marshal
> test_minidom
> test test_minidom failed -- Writing: "Test Failed: testGetElementsByTagNameNS\nWriting: 'Failed Test', expected: ''\n", expected: ''
> test_pyexpat
> test_pyxmldom
> Warning: can't open ./output/test_pyxmldom
> test_sax
> test_sax2
> test_sax2_xmlproc
> test_sax_xmlproc
> test_saxdrivers
> test_utils
> test_xmlbuilder
> test test_xmlbuilder crashed -- exceptions.AssertionError : 
> [(('http://www.w3.org/2000/xmlns/', None), u'http://xml.python.org/a'),
>  (('http://www.w3.org/2000/xmlns/', None), u'http://xml.python.org/a'),
>  (('http://www.w3.org/2000/xmlns/', None), u'http://xml.python.org/b'),
>  ((u'http://xml.python.org/a', None), u'a'),
>  ((u'http://xml.python.org/b', None), u'b')]
> test_xmlproc
> 17 tests OK.
> 2 tests failed: test_minidom test_xmlbuilder
> cd test && PYTHONPATH=../build/lib.linux-i686-2.3 python2.3 testxml.py
> Traceback (most recent call last):
>   File "test_minidom.py", line 773, in ?
>     func()
>   File "test_minidom.py", line 247, in testGetElementsByTagNameNS
>     confirm(len(elem) == 1)
>   File "test_minidom.py", line 25, in confirm
>     print "Failed " + testname
>   File "regrtest.py", line 205, in write
>     raise test_support.TestFailed, \
> TestFailed: Writing: 'Failed Test', expected: ''
> test_c14n
> test_dom
> test_encodings
> test_filter
> test_howto
> test_htmlb
> test_javadom
> test_marshal
> test_minidom
> test test_minidom failed -- Writing: "Test Failed: testGetElementsByTagNameNS\nWriting: 'Failed Test', expected: ''\n", expected: ''
> test_pyexpat
> test_pyxmldom
> Warning: can't open ./output/test_pyxmldom
> test_sax
> test_sax2
> test_sax2_xmlproc
> test_sax_xmlproc
> test_saxdrivers
> test_utils
> test_xmlbuilder
> test test_xmlbuilder crashed -- exceptions.AssertionError : 
> [(('http://www.w3.org/2000/xmlns/', None), u'http://xml.python.org/a'),
>  (('http://www.w3.org/2000/xmlns/', None), u'http://xml.python.org/a'),
>  (('http://www.w3.org/2000/xmlns/', None), u'http://xml.python.org/b'),
>  ((u'http://xml.python.org/a', None), u'a'),
>  ((u'http://xml.python.org/b', None), u'b')]
> test_xmlproc
> 17 tests OK.
> 2 tests failed: test_minidom test_xmlbuilder
> ------------------------------------------------------------------------
> 
> (I'd *really* like to see the PyXML tests all be converted to use
> unittest, but haven't had the time to deal with that yet.  ;-(  )
> 
> 
>   -Fred
> 
> -- 
> Fred L. Drake, Jr.  <fdrake at acm.org>
> PythonLabs at Zope Corporation
-- 
Mike Olson                                Principal Consultant
mike.olson@fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St,                      http://4Suite.org
Boulder, CO 80301-2537, USA
XML strategy, XML tools, knowledge management