diff options
author | Erlend E. Aasland <erlend.aasland@protonmail.com> | 2023-02-01 11:41:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-01 11:41:30 (GMT) |
commit | 2b3e02a705907d0db2ce5266f06ad88a6b6160db (patch) | |
tree | c8a1bb0b5bf74a2054e179a930ba365b09535332 /Lib/test/test_itertools.py | |
parent | cc407b9de645ab7c137df8ea2409a005369169a5 (diff) | |
download | cpython-2b3e02a705907d0db2ce5266f06ad88a6b6160db.zip cpython-2b3e02a705907d0db2ce5266f06ad88a6b6160db.tar.gz cpython-2b3e02a705907d0db2ce5266f06ad88a6b6160db.tar.bz2 |
gh-101277: Isolate itertools, add group and _grouper types to module state (#101302)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r-- | Lib/test/test_itertools.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index b447b6c..7014bc9 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -1694,6 +1694,38 @@ class TestBasicOps(unittest.TestCase): gc.collect() self.assertTrue(gc.is_tracked(next(it))) + @support.cpython_only + def test_immutable_types(self): + from itertools import _grouper, _tee, _tee_dataobject + dataset = ( + accumulate, + batched, + chain, + combinations, + combinations_with_replacement, + compress, + count, + cycle, + dropwhile, + filterfalse, + groupby, + _grouper, + islice, + pairwise, + permutations, + product, + repeat, + starmap, + takewhile, + _tee, + _tee_dataobject, + zip_longest, + ) + for tp in dataset: + with self.subTest(tp=tp): + with self.assertRaisesRegex(TypeError, "immutable"): + tp.foobar = 1 + class TestExamples(unittest.TestCase): |