summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py32
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):