MCPcopy Index your code
hub / github.com/python/cpython / SequenceClass

Class SequenceClass

Lib/test/test_functools.py:1094–1101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1092 # Test reduce()'s use of iterators.
1093 def test_iterator_usage(self):
1094 class SequenceClass:
1095 def __init__(self, n):
1096 self.n = n
1097 def __getitem__(self, i):
1098 if 0 <= i < self.n:
1099 return i
1100 else:
1101 raise IndexError
1102
1103 from operator import add
1104 self.assertEqual(self.reduce(add, SequenceClass(5)), 10)

Callers 1

test_iterator_usageMethod · 0.70

Calls

no outgoing calls

Tested by 1

test_iterator_usageMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…