summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2014-05-01 12:49:47 +0900
committershimizukawa <shimizukawa@gmail.com>2014-05-01 12:49:47 +0900
commitfeb0ea1655f5ff63c0fc0a434ed8b5a5434c441d (patch)
treeb72f0ba3bf1b2b3c1db4b26355a6dc0b95eddbe8
parent7732b39d8ccc49e2c9426bd13f3d1de152200e69 (diff)
downloadsphinx-feb0ea1655f5ff63c0fc0a434ed8b5a5434c441d.tar.gz
use 'next(iter)' instead of 'iter.next()' to support py2/py3 compatibiity. refs #1350.
-rw-r--r--tests/etree13/ElementPath.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/etree13/ElementPath.py b/tests/etree13/ElementPath.py
index b097d816..d26a0d7a 100644
--- a/tests/etree13/ElementPath.py
+++ b/tests/etree13/ElementPath.py
@@ -177,7 +177,7 @@ class _SelectorContext:
def find(elem, path):
try:
- return findall(elem, path).next()
+ return next(findall(elem, path))
except StopIteration:
return None
@@ -194,17 +194,17 @@ def findall(elem, path):
if path[:1] == "/":
raise SyntaxError("cannot use absolute path on element")
stream = iter(xpath_tokenizer(path))
- next = stream.next; token = next()
+ next_ = lambda: next(stream); token = next_()
selector = []
while 1:
try:
- selector.append(ops[token[0]](next, token))
+ selector.append(ops[token[0]](next_, token))
except StopIteration:
raise SyntaxError("invalid path")
try:
- token = next()
+ token = next_()
if token[0] == "/":
- token = next()
+ token = next_()
except StopIteration:
break
_cache[path] = selector
@@ -220,7 +220,7 @@ def findall(elem, path):
def findtext(elem, path, default=None):
try:
- elem = findall(elem, path).next()
+ elem = next(findall(elem, path))
return elem.text
except StopIteration:
return default