Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_itertools.py does not test infinite iterable for itertools.chain.from_iterable #93814

Closed
youknowone opened this issue Jun 14, 2022 · 2 comments · Fixed by #93815
Closed

test_itertools.py does not test infinite iterable for itertools.chain.from_iterable #93814

youknowone opened this issue Jun 14, 2022 · 2 comments · Fixed by #93815
Assignees
Labels
tests type-bug

Comments

@youknowone
Copy link
Contributor

@youknowone youknowone commented Jun 14, 2022

Bug report

itertools.chain.from_iterable is safe to use with infinite iterable, but no test exists.

example:

chain.from_iterable(repeat(range(5)))

Your environment

  • CPython versions tested on:
    3.10.4 and current main branch

  • Operating system and architecture:
    N/A

@youknowone youknowone added the type-bug label Jun 14, 2022
@AlexWaygood AlexWaygood added the tests label Jun 14, 2022
@rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Jun 14, 2022

ISTM there is no point in adding another test for this. Infinite iterators a just a special case of "bigger than you can reasonably consume".

From a consumers point of view, there is no way to differentiate an infinite iterator from a huge iterator (c.f. the halting problem).

@youknowone
Copy link
Contributor Author

@youknowone youknowone commented Jun 14, 2022

The test will prevent a potential regression to evaluate given iterable before consuming.

Please let me know if there is a test already covers a huge iterator.
I found test_long_chain_of_empty_iterables is a similar one, but it doesn't fully prevent it.

ref: RustPython/RustPython#3787

miss-islington pushed a commit that referenced this issue Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants