[Lxml-checkins] r46552 - lxml/trunk/src/lxml/tests

scoder at codespeak.net scoder at codespeak.net
Thu Sep 13 19:38:59 CEST 2007


Author: scoder
Date: Thu Sep 13 19:38:58 2007
New Revision: 46552

Modified:
   lxml/trunk/src/lxml/tests/common_imports.py
Log:
prefer 3rd party imports of ET over xml.etree

Modified: lxml/trunk/src/lxml/tests/common_imports.py
==============================================================================
--- lxml/trunk/src/lxml/tests/common_imports.py	(original)
+++ lxml/trunk/src/lxml/tests/common_imports.py	Thu Sep 13 19:38:58 2007
@@ -6,18 +6,19 @@
 from lxml import etree
 
 try:
-    from xml.etree import ElementTree # Python 2.5+
+    from elementtree import ElementTree # standard ET
+    print ElementTree.VERSION
 except ImportError:
     try:
-        from elementtree import ElementTree # standard ET
+        from xml.etree import ElementTree # Python 2.5+
     except ImportError:
         ElementTree = None
 
 try:
-    from xml.etree import cElementTree # Python 2.5+
+    import cElementTree # standard ET
 except ImportError:
     try:
-        import cElementTree # standard ET
+        from xml.etree import cElementTree # Python 2.5+
     except ImportError:
         cElementTree = None
 
@@ -31,6 +32,14 @@
     # we need our own version to make it work (Python 2.3?)
     import local_doctest as doctest
 
+try:
+    sorted
+except NameError:
+    def sorted(seq, **kwargs):
+        seq = list(seq)
+        seq.sort(**kwargs)
+        return seq
+
 class HelperTestCase(unittest.TestCase):
     def parse(self, text):
         f = StringIO(text)


More information about the lxml-checkins mailing list