'Should rollback to initial offsets on context exit with exception.'

def test_rollback(self):

    with self.assertRaises(Exception):
        with self.context as context:
            context.mark(self.partition, 0)
            self.consumer.offsets = {self.partition: 1}
            raise Exception('Intentional    failure')
    self.assertEqual(self.consumer.offsets, {self.partition: 0})
    self.assertEqual(self.consumer.seek.call_count, 1)
    self.assertEqual(self.consumer.seek.call_args[0], (0, 1))
