@@ -38,12 +38,17 @@ def tearDownClass(cls):
3838 def tearDown (self ):
3939 self .text .delete ('1.0' , 'end' )
4040
41+ def get_parenmatch (self ):
42+ pm = ParenMatch (self .editwin )
43+ pm .bell = lambda : None
44+ return pm
45+
4146 def test_paren_expression (self ):
4247 """
4348 Test ParenMatch with 'expression' style.
4449 """
4550 text = self .text
46- pm = ParenMatch ( self .editwin )
51+ pm = self .get_parenmatch ( )
4752 pm .set_style ('expression' )
4853
4954 text .insert ('insert' , 'def foobar(a, b' )
@@ -66,7 +71,7 @@ def test_paren_default(self):
6671 Test ParenMatch with 'default' style.
6772 """
6873 text = self .text
69- pm = ParenMatch ( self .editwin )
74+ pm = self .get_parenmatch ( )
7075 pm .set_style ('default' )
7176
7277 text .insert ('insert' , 'def foobar(a, b' )
@@ -86,7 +91,7 @@ def test_paren_corner(self):
8691 These cases force conditional expression and alternate paths.
8792 """
8893 text = self .text
89- pm = ParenMatch ( self .editwin )
94+ pm = self .get_parenmatch ( )
9095
9196 text .insert ('insert' , '# this is a commen)' )
9297 self .assertIsNone (pm .paren_closed_event ('event' ))
@@ -99,7 +104,7 @@ def test_paren_corner(self):
99104 self .assertIsNone (pm .paren_closed_event ('event' ))
100105
101106 def test_handle_restore_timer (self ):
102- pm = ParenMatch ( self .editwin )
107+ pm = self .get_parenmatch ( )
103108 pm .restore_event = Mock ()
104109 pm .handle_restore_timer (0 )
105110 self .assertTrue (pm .restore_event .called )
0 commit comments