1
- import os
2
1
from collections import namedtuple
3
2
from tkinter import Text
4
3
import unittest
@@ -250,22 +249,22 @@ def test_expand_last_squeezed_event(self):
250
249
self .assertEqual (retval , "break" )
251
250
self .assertEqual (squeezer .text .bell .call_count , 1 )
252
251
253
- def test_preview_last_squeezed_event_no_squeezed (self ):
254
- """test the preview_last_squeezed event"""
252
+ def test_view_last_squeezed_event_no_squeezed (self ):
253
+ """test the view_last_squeezed event"""
255
254
# The tested scenario: There are no squeezed texts, therefore there
256
- # are no ExpandingButton instances. The preview_last_squeezed event
255
+ # are no ExpandingButton instances. The view_last_squeezed event
257
256
# is called and should fail (i.e. call squeezer.text.bell()).
258
257
editwin = self .make_mock_editor_window ()
259
258
squeezer = self .make_squeezer_instance (editwin )
260
259
261
- retval = squeezer .preview_last_squeezed_event (event = Mock ())
260
+ retval = squeezer .view_last_squeezed_event (event = Mock ())
262
261
self .assertEqual (retval , "break" )
263
262
264
- def test_preview_last_squeezed_event (self ):
265
- """test the preview_last_squeezed event"""
263
+ def test_view_last_squeezed_event (self ):
264
+ """test the view_last_squeezed event"""
266
265
# The tested scenario: There are two squeezed texts, therefore there
267
- # are two ExpandingButton instances. The preview_last_squeezed event
268
- # is called twice. Both times should call the preview () method of the
266
+ # are two ExpandingButton instances. The view_last_squeezed event
267
+ # is called twice. Both times should call the view () method of the
269
268
# second ExpandingButton.
270
269
editwin = self .make_mock_editor_window ()
271
270
squeezer = self .make_squeezer_instance (editwin )
@@ -274,17 +273,17 @@ def test_preview_last_squeezed_event(self):
274
273
squeezer .expandingbuttons = [mock_expandingbutton1 ,
275
274
mock_expandingbutton2 ]
276
275
277
- # check that the second expanding button is previewed
278
- retval = squeezer .preview_last_squeezed_event (event = SENTINEL_VALUE )
276
+ # check that the second expanding button is viewed
277
+ retval = squeezer .view_last_squeezed_event (event = SENTINEL_VALUE )
279
278
self .assertEqual (retval , "break" )
280
279
self .assertEqual (squeezer .text .bell .call_count , 0 )
281
- self .assertEqual (mock_expandingbutton1 .preview .call_count , 0 )
282
- self .assertEqual (mock_expandingbutton2 .preview .call_count , 1 )
283
- mock_expandingbutton2 .preview .assert_called_with (SENTINEL_VALUE )
280
+ self .assertEqual (mock_expandingbutton1 .view .call_count , 0 )
281
+ self .assertEqual (mock_expandingbutton2 .view .call_count , 1 )
282
+ mock_expandingbutton2 .view .assert_called_with (SENTINEL_VALUE )
284
283
285
- squeezer .preview_last_squeezed_event (event = SENTINEL_VALUE )
286
- self .assertEqual (mock_expandingbutton1 .preview .call_count , 0 )
287
- self .assertEqual (mock_expandingbutton2 .preview .call_count , 2 )
284
+ squeezer .view_last_squeezed_event (event = SENTINEL_VALUE )
285
+ self .assertEqual (mock_expandingbutton1 .view .call_count, 0 )
286
+ self .assertEqual (mock_expandingbutton2 .view .call_count , 2 )
288
287
289
288
def test_auto_squeeze (self ):
290
289
"""test that the auto-squeezing creates an ExpandingButton properly"""
@@ -565,16 +564,16 @@ def test_copy(self):
565
564
self .assertEqual (expandingbutton .clipboard_append .call_count , 1 )
566
565
expandingbutton .clipboard_append .assert_called_with ('TEXT' )
567
566
568
- def test_preview (self ):
569
- """test the preview event"""
567
+ def test_view (self ):
568
+ """test the view event"""
570
569
squeezer = self .make_mock_squeezer ()
571
570
expandingbutton = ExpandingButton ('TEXT' , 'TAGS' , 50 , squeezer )
572
571
expandingbutton .selection_own = Mock ()
573
572
574
573
with patch ('idlelib.squeezer.view_text' , autospec = view_text )\
575
574
as mock_view_text :
576
- # trigger the preview event
577
- expandingbutton .preview (event = Mock ())
575
+ # trigger the view event
576
+ expandingbutton .view (event = Mock ())
578
577
579
578
# check that the expanding button called view_text
580
579
self .assertEqual (mock_view_text .call_count , 1 )
0 commit comments