summaryrefslogtreecommitdiff
path: root/tests/etree13/ElementTree.py
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2014-01-19 14:17:10 +0400
committerDmitry Shachnev <mitya57@gmail.com>2014-01-19 14:17:10 +0400
commit344417db950d6e816ab2efb21737c2bdf9d1ad53 (patch)
tree97b00b55be0e28a73399acc0f80e21e6a4e24b28 /tests/etree13/ElementTree.py
parent59b355edaa4f17aff910bf2371526d5ce46fb648 (diff)
downloadsphinx-344417db950d6e816ab2efb21737c2bdf9d1ad53.tar.gz
Modernize the code now that Python 2.5 is no longer supported
- Use print function instead of print statement; - Use new exception handling; - Use in operator instead of has_key(); - Do not use tuple arguments in functions; - Other miscellaneous improvements. This is based on output of `futurize --stage1`, with some manual corrections.
Diffstat (limited to 'tests/etree13/ElementTree.py')
-rw-r--r--tests/etree13/ElementTree.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/etree13/ElementTree.py b/tests/etree13/ElementTree.py
index f459c7f8..892b08a0 100644
--- a/tests/etree13/ElementTree.py
+++ b/tests/etree13/ElementTree.py
@@ -79,6 +79,7 @@
# --------------------------------------------------------------------
from __future__ import generators
+from __future__ import absolute_import
__all__ = [
# public symbols
@@ -144,7 +145,7 @@ class _SimpleElementPath(object):
return result
try:
- import ElementPath
+ from . import ElementPath
except ImportError:
# FIXME: issue warning in this case?
ElementPath = _SimpleElementPath()
@@ -1524,7 +1525,7 @@ class XMLParser(object):
def feed(self, data):
try:
self._parser.Parse(data, 0)
- except self._error, v:
+ except self._error as v:
self._raiseerror(v)
##
@@ -1536,7 +1537,7 @@ class XMLParser(object):
def close(self):
try:
self._parser.Parse("", 1) # end of data
- except self._error, v:
+ except self._error as v:
self._raiseerror(v)
tree = self.target.close()
del self.target, self._parser # get rid of circular references