def test_multiple_item_sequence(self):
     "Middle items of a multi-item sequence are neither first or last"
     eq_(list(forloop([1, 2, 3, 4])),
         [(True, 1, False),
          (False, 2, False),
          (False, 3, False),
          (False, 4, True)])
 def test_one_item_sequence(self):
     "The only item of a one-item sequence is both first and last"
     items = forloop(['the only item'])
     first, item, last = items.next()
     assert_true(first)
     eq_(item, 'the only item')
     assert_true(last)
     assert_raises(StopIteration, items.next)
 def test_two_item_sequence(self):
     "Item 1 of a two-item sequence is the first and item 2 the last"
     eq_(list(forloop(['the first item', 'the second item'])),
         [(True, 'the first item', False),
          (False, 'the second item', True)])
 def test_empty_sequence(self):
     "An empty sequence should yield no results"
     eq_(list(forloop([])), [])