File tree 7 files changed +11
-11
lines changed
7 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ def test_click_help(self):
98
98
dialog .buttons ['Help' ].invoke ()
99
99
title , contents = view .kwds ['title' ], view .kwds ['contents' ]
100
100
self .assertEqual (title , 'Help for IDLE preferences' )
101
- self .assertTrue (contents . startswith ( 'When you click' ) and
102
- contents . endswith ( 'a different name.\n ' ) )
101
+ self .assertStartsWith (contents , 'When you click' )
102
+ self . assertEndsWith ( contents , 'a different name.\n ' )
103
103
104
104
105
105
class FontPageTest (unittest .TestCase ):
Original file line number Diff line number Diff line change @@ -256,7 +256,7 @@ def test_init(self):
256
256
flist = None
257
257
master_window = self .root
258
258
sv = debugger .StackViewer (master_window , flist , gui )
259
- self .assertTrue ( hasattr ( sv , 'stack' ) )
259
+ self .assertHasAttr ( sv , 'stack' )
260
260
261
261
def test_load_stack (self ):
262
262
# Test the .load_stack() method against a fixed test stack.
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ def test_found(self):
143
143
self .assertIn (pat , lines [0 ])
144
144
self .assertIn ('py: 1:' , lines [1 ]) # line number 1
145
145
self .assertIn ('2' , lines [3 ]) # hits found 2
146
- self .assertTrue (lines [4 ]. startswith ( '(Hint:' ) )
146
+ self .assertStartsWith (lines [4 ], '(Hint:' )
147
147
148
148
149
149
class Default_commandTest (unittest .TestCase ):
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def tearDownClass(cls):
27
27
def test_creator (self ):
28
28
mc = self .mc
29
29
self .assertIs (multicall ._multicall_dict [Text ], mc )
30
- self .assertTrue ( issubclass ( mc , Text ) )
30
+ self .assertIsSubclass ( mc , Text )
31
31
mc2 = multicall .MultiCallCreator (Text )
32
32
self .assertIs (mc , mc2 )
33
33
Original file line number Diff line number Diff line change @@ -134,10 +134,10 @@ def test_c_source_name(self):
134
134
135
135
def test_good_module_name (self ):
136
136
dialog = self .Dummy_ModuleName ('idlelib' )
137
- self .assertTrue (dialog .entry_ok (). endswith ( '__init__.py' ) )
137
+ self .assertEndsWith (dialog .entry_ok (), '__init__.py' )
138
138
self .assertEqual (dialog .entry_error ['text' ], '' )
139
139
dialog = self .Dummy_ModuleName ('idlelib.idle' )
140
- self .assertTrue (dialog .entry_ok (). endswith ( 'idle.py' ) )
140
+ self .assertEndsWith (dialog .entry_ok (), 'idle.py' )
141
141
self .assertEqual (dialog .entry_error ['text' ], '' )
142
142
143
143
@@ -389,7 +389,7 @@ def test_click_module_name(self):
389
389
self .assertEqual (dialog .text0 , 'idlelib' )
390
390
self .assertEqual (dialog .entry .get (), 'idlelib' )
391
391
dialog .button_ok .invoke ()
392
- self .assertTrue (dialog .result . endswith ( '__init__.py' ) )
392
+ self .assertEndsWith (dialog .result , '__init__.py' )
393
393
root .destroy ()
394
394
395
395
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def test_close(self):
34
34
redir .register ('insert' , Func )
35
35
redir .close ()
36
36
self .assertEqual (redir ._operations , {})
37
- self .assertFalse ( hasattr ( self .text , 'widget' ) )
37
+ self .assertNotHasAttr ( self .text , 'widget' )
38
38
39
39
40
40
class WidgetRedirectorTest (unittest .TestCase ):
Original file line number Diff line number Diff line change @@ -725,7 +725,7 @@ def test_copy(self):
725
725
726
726
text .tag_add ('sel' , f'{ first_line } .0' , 'end-1c' )
727
727
selected_text = text .get ('sel.first' , 'sel.last' )
728
- self .assertTrue (selected_text . startswith ( 'if True:\n ' ) )
728
+ self .assertStartsWith (selected_text , 'if True:\n ' )
729
729
self .assertIn ('\n 1\n ' , selected_text )
730
730
731
731
text .event_generate ('<<copy>>' )
@@ -749,7 +749,7 @@ def test_copy_with_prompts(self):
749
749
750
750
text .tag_add ('sel' , f'{ first_line } .3' , 'end-1c' )
751
751
selected_text = text .get ('sel.first' , 'sel.last' )
752
- self .assertTrue (selected_text . startswith ( 'True:\n ' ) )
752
+ self .assertStartsWith (selected_text , 'True:\n ' )
753
753
754
754
selected_lines_text = text .get ('sel.first linestart' , 'sel.last' )
755
755
selected_lines = selected_lines_text .split ('\n ' )
You can’t perform that action at this time.
0 commit comments