mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-101277: Isolate itertools, add group and _grouper types to module state (#101302)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
cc407b9de6
commit
2b3e02a705
3 changed files with 173 additions and 111 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue