[Python-checkins] CVS: python/dist/src/Lib/test test_minidom.py,1.30,1.31

Fred L. Drake fdrake@users.sourceforge.net
2001年12月06日 10:27:50 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv12898/test
Modified Files:
	test_minidom.py 
Log Message:
Attribute nodes did not always get their ownerDocument and ownerElement
properly set. This fixes that.
Index: test_minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** test_minidom.py	2001年12月06日 04:32:18	1.30
--- test_minidom.py	2001年12月06日 18:27:48	1.31
***************
*** 167,170 ****
--- 167,187 ----
 dom.unlink()
 
+ def testNamedNodeMapSetItem():
+ dom = Document()
+ elem = dom.createElement('element')
+ attrs = elem.attributes
+ attrs["foo"] = "bar"
+ a = attrs.item(0)
+ confirm(a.ownerDocument is dom,
+ "NamedNodeMap.__setitem__() sets ownerDocument")
+ confirm(a.ownerElement is elem,
+ "NamedNodeMap.__setitem__() sets ownerElement")
+ confirm(a.value == "bar",
+ "NamedNodeMap.__setitem__() sets value")
+ confirm(a.nodeValue == "bar",
+ "NamedNodeMap.__setitem__() sets nodeValue")
+ elem.unlink()
+ dom.unlink()
+ 
 def testNonZero():
 dom = parse(tstfile)
***************
*** 189,192 ****
--- 206,214 ----
 el.setAttribute("spam", "jam2")
 confirm(el.toxml() == '<abc spam="jam2"/>', "testAAA")
+ a = el.getAttributeNode("spam")
+ confirm(a.ownerDocument is dom,
+ "setAttribute() sets ownerDocument")
+ confirm(a.ownerElement is dom.documentElement,
+ "setAttribute() sets ownerElement")
 dom.unlink()
 

AltStyle によって変換されたページ (->オリジナル) /