MCPcopy Index your code
hub / github.com/RustPython/RustPython / SequenceClass

Class SequenceClass

Lib/test/test_functools.py:1030–1037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1028 # Test reduce()'s use of iterators.
1029 def test_iterator_usage(self):
1030 class SequenceClass:
1031 def __init__(self, n):
1032 self.n = n
1033 def __getitem__(self, i):
1034 if 0 <= i < self.n:
1035 return i
1036 else:
1037 raise IndexError
1038
1039 from operator import add
1040 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