[4suite-checkins] [XML1_0-maint] In 4Suite/test/Xml/Core, files test_nss.py

Jeremy Kloth jkloth at 4suite.org
Tue Nov 7 14:40:23 MST 2006


Branch: XML1_0-maint

Modified Files:
    test_nss.py

Log Message:
Fixed error with default namespaces in GetAllNs(). 

ViewCVS diff:
  http://cvs.4suite.org/viewcvs/4Suite/test/Xml/Core/test_nss.py.diff?r1=1.3&r2=1.3.4.1
ViewCVS view:
  http://cvs.4suite.org/viewcvs/4Suite/test/Xml/Core/test_nss.py?rev=1.3.4.1&content-type=text/vnd.viewcvs-markup

Index: test_nss.py
===================================================================
RCS file: /var/local/cvsroot/4Suite/test/Xml/Core/test_nss.py,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -U2 -r1.3 -r1.3.4.1
--- test_nss.py	17 Dec 2004 00:00:14 -0000	1.3
+++ test_nss.py	7 Nov 2006 21:40:22 -0000	1.3.4.1
@@ -4,5 +4,5 @@
 def test_get_all_ns(tester, module):
     tester.startGroup("GetAllNs")
-    
+
     src_1 = """
 <foo:bar xmlns:foo='http://foo.com'><baz:bar xmlns:baz='http://baz.com'/>
@@ -57,4 +57,30 @@
     tester.testDone()
 
+    src_3 = """
+<data xmlns="http://default.com">
+  <group xmlns=""><e/></group>
+  <group><e/></group>
+</data>
+"""
+    isrc = InputSource.DefaultFactory.fromString(src_3, "dummy")
+    doc = module.NonvalParse(isrc)
+
+    tester.startTest("Default xmlns declaration")
+    node1 = doc.documentElement.childNodes[1].firstChild
+    node2 = doc.documentElement.childNodes[3].firstChild
+    nss1 = module.GetAllNs(node1)
+    tester.compare(1, len(nss1))
+    tester.compare(True, 'xml' in nss1)
+    tester.compare('http://www.w3.org/XML/1998/namespace', nss1['xml'])
+    tester.compare(False, None in nss1)
+
+    nss2 = module.GetAllNs(node2)
+    tester.compare(2, len(nss2))
+    tester.compare(True, 'xml' in nss2)
+    tester.compare('http://www.w3.org/XML/1998/namespace', nss2['xml'])
+    tester.compare(True, None in nss2)
+    tester.compare('http://default.com', nss2[None])
+    tester.testDone()
+
     doc = module.implementation.createDocument(None,None,None)
     elem = doc.createElementNS("http://element.com","foo:root")
@@ -75,5 +101,5 @@
 def test_seek_nss(tester, module):
     tester.startGroup("SeekNss")
-    
+
     src_1 = """
 <foo:bar xmlns:foo='http://foo.com'>
@@ -174,8 +200,8 @@
     tester.startTest("Multiple redefined xmlns declarations")
     src_5 = """
-<S:foo xmlns:S="http://example.com/1"> 
-  <bar>test</bar> 
-  <bar xmlns='http://example.com/2'>test2</bar> 
-  <S:bar xmlns:S='http://example.com/2'>test2</S:bar> 
+<S:foo xmlns:S="http://example.com/1">
+  <bar>test</bar>
+  <bar xmlns='http://example.com/2'>test2</bar>
+  <S:bar xmlns:S='http://example.com/2'>test2</S:bar>
 </S:foo>"""
     isrc = InputSource.DefaultFactory.fromString(src_5, "dummy")


More information about the 4suite-checkins mailing list