Example #1
0
async def test_chain_non_iterables():
    """Check that chain raises TypeError if given non-iterable values."""
    with pytest.raises(TypeError):

        await aitertools.anext(aitertools.chain(1, 2))
Example #2
0
async def test_chain_single_iterable():
    """Check if chain works when given only one iterable."""
    assert (await aitertools.alist(
        aitertools.chain('abc')
    )) == list('abc')
Example #3
0
async def test_chain_empty_iterable():
    """Check that chain result is empty if all iterables are empty."""
    assert (await aitertools.alist(
        aitertools.chain([])
    )) == []
Example #4
0
async def test_chain_combines_iterables():
    """Check that chain produces values from all iterables."""
    assert (await aitertools.alist(
        aitertools.chain('abc', 'def')
    )) == list('abcdef')