Commit 6c9d4a19 authored by Andrey Golovizin's avatar Andrey Golovizin

Use six.moves.zip_longest

parent 642d9eac
......@@ -30,10 +30,11 @@ https://github.com/matthew-brett/babybib
"""
from __future__ import absolute_import, unicode_literals
from itertools import izip_longest
from unittest import TestCase
import six
from six.moves import zip_longest
from pybtex.database import BibliographyData, Entry, Person
from pybtex.database.input.bibtex import Parser
......@@ -65,7 +66,7 @@ class ParserTest(object):
result = parser.data
correct_result = self.correct_result
assert result == correct_result
for error, correct_error in izip_longest(parser.errors, self.errors):
for error, correct_error in zip_longest(parser.errors, self.errors):
actual_error = six.text_type(error)
assert actual_error == correct_error
......
from __future__ import unicode_literals
import pkgutil
from itertools import izip_longest
from six.moves import zip_longest
from pybtex.bibtex import bst
......@@ -18,7 +19,7 @@ def check_bst_parser(dataset_name):
bst_data = pkgutil.get_data('pybtex.tests.data', dataset_name + '.bst').decode('latin1')
actual_result = bst.parse_string(bst_data)
for correct_element, actual_element in izip_longest(actual_result, correct_result):
for correct_element, actual_element in zip_longest(actual_result, correct_result):
assert correct_element == actual_element, '\n{0}\n{1}'.format(correct_element, actual_element)
......
......@@ -30,6 +30,8 @@ from collections import (
from functools import wraps
from types import GeneratorType
from six.moves import zip_longest
from .py3compat import fix_unicode_literals_in_doctest
......@@ -72,7 +74,7 @@ def collect_iterable(f):
def pairwise(iterable):
a, b = itertools.tee(iterable)
next(b, None)
return itertools.izip_longest(a, b)
return zip_longest(a, b)
@fix_unicode_literals_in_doctest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment