summaryrefslogtreecommitdiffstats
path: root/Lib/xml/etree/ElementTree.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-06-15 06:03:19 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-06-15 06:03:19 (GMT)
commit27cbb19ae562f258e64120c8ed17616719e32722 (patch)
treeeb86cb9bb67e87f5134dbf0ed728cdd288ea013f /Lib/xml/etree/ElementTree.py
parent175fada42943d627dea4ebd9527ca1d6e9b62cca (diff)
downloadcpython-27cbb19ae562f258e64120c8ed17616719e32722.zip
cpython-27cbb19ae562f258e64120c8ed17616719e32722.tar.gz
cpython-27cbb19ae562f258e64120c8ed17616719e32722.tar.bz2
Removed _SimpleElementPath and its flaky test. The test monkey-patches the module, which causes other failures and fails itself depending on the order tests are run.
Diffstat (limited to 'Lib/xml/etree/ElementTree.py')
-rw-r--r--Lib/xml/etree/ElementTree.py26
1 files changed, 1 insertions, 25 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index 4776625..d30a83c 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -101,32 +101,8 @@ import sys
import re
import warnings
-class _SimpleElementPath:
- # emulate pre-1.2 find/findtext/findall behaviour
- def find(self, element, tag, namespaces=None):
- for elem in element:
- if elem.tag == tag:
- return elem
- return None
- def findtext(self, element, tag, default=None, namespaces=None):
- elem = self.find(element, tag)
- if elem is None:
- return default
- return elem.text or ""
- def iterfind(self, element, tag, namespaces=None):
- if tag[:3] == ".//":
- for elem in element.iter(tag[3:]):
- yield elem
- for elem in element:
- if elem.tag == tag:
- yield elem
- def findall(self, element, tag, namespaces=None):
- return list(self.iterfind(element, tag, namespaces))
+from . import ElementPath
-try:
- from . import ElementPath
-except ImportError:
- ElementPath = _SimpleElementPath()
##
# Parser error. This is a subclass of <b>SyntaxError</b>.