async def test_count_invalid_start(): """Check that count raises TypeError when start is not a number.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.count('a'))
async def test_count_negative_step(): """Check that count can handle negative step values.""" counter = aitertools.count(0, -1) assert (await aitertools.anext(counter)) == 0 assert (await aitertools.anext(counter)) == -1
async def test_count_too_many_args(): """Check that count raises TypeError when too many args.""" with pytest.raises(TypeError): await aitertools.anext(aitertools.count(1, 2, 3))
async def test_count_custom_step(): """Check that a custom step can be given.""" counter = aitertools.count(0, 2) assert (await aitertools.anext(counter)) == 0 assert (await aitertools.anext(counter)) == 2
async def test_count_steps_one(): """Check that the default count step is one.""" counter = aitertools.count() assert (await aitertools.anext(counter)) == 0 assert (await aitertools.anext(counter)) == 1
async def test_count_negative_start(): """Check that count can start with negative values.""" assert (await aitertools.anext(aitertools.count(-1))) == -1
async def test_count_custom_start(): """Check that count can be give a custom start.""" assert (await aitertools.anext(aitertools.count(3))) == 3
async def test_count_starts_at_zero(): """Check that default counts start as zero.""" assert (await aitertools.anext(aitertools.count())) == 0