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))
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]))
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))
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]
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]