# Path: terminaltables/build.py
# def combine(line, left, intersect, right):
#     """Zip borders between items in `line`.
# 
#     e.g. ('l', '1', 'c', '2', 'c', '3', 'r')
# 
#     :param iter line: List to iterate.
#     :param left: Left border.
#     :param intersect: Column separator.
#     :param right: Right border.
# 
#     :return: Yields combined objects.
#     """
#     # Yield left border.
#     if left:
#         yield left
# 
#     # Yield items with intersect characters.
#     if intersect:
#         try:
#             for j, i in enumerate(line, start=-len(line) + 1):
#                 yield i
#                 if j:
#                     yield intersect
#         except TypeError:  # Generator.
#             try:
#                 item = next(line)
#             except StopIteration:  # Was empty all along.
#                 pass
#             else:
#                 while True:
#                     yield item
#                     try:
#                         peek = next(line)
#                     except StopIteration:
#                         break
#                     yield intersect
#                     item = peek
#     else:
#         for i in line:
#             yield i
# 
#     # Yield right border.
#     if right:
#         yield right


import pytest
from terminaltables.build import combine
"""Test function in module."""




@pytest.mark.parametrize('generator', [False, True])
def test_borders(generator):
    """Test with borders.

    :param bool generator: Test with generator instead of list.
    """
    line = ['One', 'Two', 'Three']
    actual = list(combine(iter(line) if generator else line, '>', '|', '<'))
    assert actual == ['>', 'One', '|', 'Two', '|', 'Three', '<']


@pytest.mark.parametrize('generator', [False, True])
def test_no_border(generator):
    """Test without borders.

    :param bool generator: Test with generator instead of list.
    """
    line = ['One', 'Two', 'Three']

# Path: terminaltables/build.py
# def combine(line, left, intersect, right):
#     """Zip borders between items in `line`.
# 
#     e.g. ('l', '1', 'c', '2', 'c', '3', 'r')
# 
#     :param iter line: List to iterate.
#     :param left: Left border.
#     :param intersect: Column separator.
#     :param right: Right border.
# 
#     :return: Yields combined objects.
#     """
#     # Yield left border.
#     if left:
#         yield left
# 
#     # Yield items with intersect characters.
#     if intersect:
#         try:
#             for j, i in enumerate(line, start=-len(line) + 1):
#                 yield i
#                 if j:
#                     yield intersect
#         except TypeError:  # Generator.
#             try:
#                 item = next(line)
#             except StopIteration:  # Was empty all along.
#                 pass
#             else:
#                 while True:
#                     yield item
#                     try:
#                         peek = next(line)
#                     except StopIteration:
#                         break
#                     yield intersect
#                     item = peek
#     else:
#         for i in line:
#             yield i
# 
#     # Yield right border.
#     if right:
#         yield right


# Path: tests/test_build/test_combine.py
import pytest
from terminaltables.build import combine

"""Test function in module."""




@pytest.mark.parametrize('generator', [False, True])
def test_borders(generator):
    """Test with borders.

    :param bool generator: Test with generator instead of list.
    """
    line = ['One', 'Two', 'Three']
    actual = list(combine(iter(line) if generator else line, '>', '|', '<'))
    assert actual == ['>', 'One', '|', 'Two', '|', 'Three', '<']


@pytest.mark.parametrize('generator', [False, True])
def test_no_border(generator):
    """Test without borders.

    :param bool generator: Test with generator instead of list.
    """
    line = ['One', 'Two', 'Three']

    actual = list(combine(iter(line) if generator else line, '', '', ''))