From 3d2c9fd003c14a4969f383cd5eb0966b7b6a3d7b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 2 Mar 2024 09:20:07 +0100 Subject: Adding upstream version 4.64.1. Signed-off-by: Daniel Baumann --- tests/tests_itertools.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/tests_itertools.py (limited to 'tests/tests_itertools.py') diff --git a/tests/tests_itertools.py b/tests/tests_itertools.py new file mode 100644 index 0000000..bfb6eb2 --- /dev/null +++ b/tests/tests_itertools.py @@ -0,0 +1,26 @@ +""" +Tests for `tqdm.contrib.itertools`. +""" +import itertools as it + +from tqdm.contrib.itertools import product + +from .tests_tqdm import StringIO, closing + + +class NoLenIter(object): + def __init__(self, iterable): + self._it = iterable + + def __iter__(self): + for i in self._it: + yield i + + +def test_product(): + """Test contrib.itertools.product""" + with closing(StringIO()) as our_file: + a = range(9) + assert list(product(a, a[::-1], file=our_file)) == list(it.product(a, a[::-1])) + + assert list(product(a, NoLenIter(a), file=our_file)) == list(it.product(a, NoLenIter(a))) -- cgit v1.2.3