MCPcopy
hub / github.com/more-itertools/more-itertools / test_abc_methods

Method test_abc_methods

tests/test_more.py:3679–3698  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3677 self.assertEqual(view[i], seq[i])
3678
3679 def test_abc_methods(self):
3680 # collections.Sequence should provide all of this functionality
3681 seq = ('a', 'b', 'c', 'd', 'e', 'f', 'f')
3682 view = mi.SequenceView(seq)
3683
3684 # __contains__
3685 self.assertIn('b', view)
3686 self.assertNotIn('g', view)
3687
3688 # __iter__
3689 self.assertEqual(list(iter(view)), list(seq))
3690
3691 # __reversed__
3692 self.assertEqual(list(reversed(view)), list(reversed(seq)))
3693
3694 # index
3695 self.assertEqual(view.index('b'), 1)
3696
3697 # count
3698 self.assertEqual(seq.count('f'), 2)
3699
3700
3701class RunLengthTest(TestCase):

Callers

nothing calls this directly

Calls 2

indexMethod · 0.80
countMethod · 0.80

Tested by

no test coverage detected