'Test ParenMatch with each style.'

def test_paren_styles(self):

    text = self.text
    pm = self.get_parenmatch()
    for (style, range1, range2) in (('opener', ('1.10', '1.11'), ('1.10', '1.11')), ('default', ('1.10', '1.11'), ('1.10', '1.11')), ('parens', ('1.14', '1.15'), ('1.15', '1.16')), ('expression', ('1.10', '1.15'), ('1.10', '1.16'))):
        with self.subTest(style=style):
            text.delete('1.0', 'end')
            pm.set_style(style)
            text.insert('insert', 'def    foobar(a,    b')
            pm.flash_paren_event('event')
            self.assertIn('<<parenmatch-check-restore>>', text.event_info())
            if (style == 'parens'):
                self.assertTupleEqual(text.tag_nextrange('paren', '1.0'), ('1.10', '1.11'))
            self.assertTupleEqual(text.tag_prevrange('paren', 'end'), range1)
            text.insert('insert', ')')
            pm.restore_event()
            self.assertNotIn('<<parenmatch-check-restore>>', text.event_info())
            self.assertEqual(text.tag_prevrange('paren', 'end'), ())
            pm.paren_closed_event('event')
            self.assertTupleEqual(text.tag_prevrange('paren', 'end'), range2)
