gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r159163 - gump/branches/Gump3/pygump/python/gump/test/testModeller.py
Date Sun, 27 Mar 2005 18:39:24 GMT
Author: leosimons
Date: Sun Mar 27 10:39:23 2005
New Revision: 159163

URL: http://svn.apache.org/viewcvs?view=rev&rev=159163
Log:
Add a basic sanity test for _find_ancestor_by_tag

Modified:
    gump/branches/Gump3/pygump/python/gump/test/testModeller.py

Modified: gump/branches/Gump3/pygump/python/gump/test/testModeller.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testModeller.py?view=diff&r1=159162&r2=159163
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testModeller.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testModeller.py Sun Mar 27 10:39:23 2005
@@ -24,6 +24,7 @@
 
 from gump.engine.modeller import _find_element_text
 from gump.engine.modeller import _do_drop
+from gump.engine.modeller import _find_ancestor_by_tag
 
 class ModellerTestCase(TestCase):
     def setUp(self):
@@ -35,6 +36,23 @@
   <stuff>ignore</stuff>
   <elem>ignore</elem>
   <blah></blah>
+  <some>
+    <nested>
+      <tags>
+        <with>
+          <some>
+            <duplicate>
+              <tags>
+                <in>
+                  <there/>
+                </in>
+              </tags>
+            </duplicate>
+          </some>
+        </with>
+      </tags>
+    </nested>
+  </some>
 </root>
 """
         self.sampledom = minidom.parseString(self.samplexml)
@@ -65,6 +83,12 @@
         self.assertEqual(0, len(self.sampledom.documentElement.getElementsByTagName("stuff")))
         self.assertEqual(1, len(dropped))
         self.assertEqual(to_remove, dropped[0])
+    
+    def test_find_ancestor_by_tag(self):
+        in_elem = self.sampledom.documentElement.getElementsByTagName("in").item(0)
+        first_some_elem = in_elem.parentNode.parentNode.parentNode
+        found_some = _find_ancestor_by_tag(in_elem, "some")
+        self.assertEqual(first_some_elem, found_some)
 
 # this is used by testrunner.py to determine what tests to run
 def test_suite():



Mime
View raw message