async def test_starmap_too_many_args(): """Check that starmap raises TypeError when too many args.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.starmap(lambda x: x, range(10), 'a'))
async def test_starmap_too_few_args(): """Check that starmap raises TypeError when too few args.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.starmap())
async def test_starmap_empty_iterable(): """Check that starmap is empty when the iterable is empty.""" assert (await aitertools.alist( aitertools.starmap(operator.pow, ()) )) == []
async def test_starmap_non_tuple_iterable_values(): """Check that starmap handles iterable values that are non-tuple.""" assert (await aitertools.alist( aitertools.starmap(operator.pow, [iter([4, 5])]) )) == [4**5]
async def test_starmap_applies_tuples(): """Check the starmap happy path.""" assert (await aitertools.alist( aitertools.starmap(operator.pow, ((0, 1), (1, 2), (2, 3))) )) == [0**1, 1**2, 2**3]