Exemplo n.º 1
0
async def test_filterfalse_too_few_args():
    """Check that filterfalse raises TypeError when too few args."""
    with pytest.raises(TypeError):

        await aitertools.anext(aitertools.filterfalse())

    with pytest.raises(TypeError):

        await aitertools.anext(aitertools.filterfalse(None))
Exemplo n.º 2
0
async def test_filterfalse_predicate_not_callable():
    """Check that filterfalse raise TypeError when predicate not callable."""
    with pytest.raises(TypeError):

        await aitertools.anext(aitertools.filterfalse([], [1]))
Exemplo n.º 3
0
async def test_filterfalse_too_many_args():
    """Check that filterfalse raises TypeError when too many args."""
    with pytest.raises(TypeError):

        await aitertools.anext(aitertools.filterfalse(1, 2, 3))
Exemplo n.º 4
0
async def test_filterfalse_defaults_to_bool():
    """Check that filterfalse uses the Truthy/Falsy values by default."""
    assert (await aitertools.alist(
        aitertools.filterfalse(None, [True, False, False, True, False, True])
    )) == [False, False, False]
Exemplo n.º 5
0
async def test_filterfalse_removes_elements_true_predicate():
    """Check that filterfalse only returns items if the predicate is False."""
    assert (await aitertools.alist(
        aitertools.filterfalse(lambda x: x % 2 == 0, range(6))
    )) == [1, 3, 5]