async def test_dropwhile_predicate_not_callable(): """Check that dropwhile raises TypeError if the predicate not callable.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.dropwhile(10, range(10)))
async def test_dropwhile_too_many_args(): """Check that dropwhile raises TypeError when too many args.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.dropwhile(1, 2, 3))
async def test_dropwhile_empty_iterable(): """Check that dropwhile is empty when the given iterable is empty.""" assert (await aitertools.alist( aitertools.dropwhile(lambda x: x < 10, []) )) == []
async def test_dropwhile_too_few_args(): """Check that dropwhile raises TypeError when too few args.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.dropwhile())
async def test_dropwhile_omits_values_while_predicate_is_true(): """Check that dropwhile omits values until the predicate returns False.""" assert (await aitertools.alist( aitertools.dropwhile(lambda x: x < 10, range(5, 15)) )) == list(range(10, 15))