@@ -539,7 +539,7 @@ def test_import_name_binding(self):
539539 import test as x
540540 import test .support
541541 self .assertIs (x , test , x .__name__ )
542- self .assertTrue ( hasattr ( test .support , "__file__" ) )
542+ self .assertHasAttr ( test .support , "__file__" )
543543
544544 # import x.y.z as w binds z as w
545545 import test .support as y
@@ -610,7 +610,7 @@ def test_file_to_source(self):
610610 sys .path .insert (0 , os .curdir )
611611 try :
612612 mod = __import__ (TESTFN )
613- self .assertTrue (mod .__file__ . endswith ( '.py' ) )
613+ self .assertEndsWith (mod .__file__ , '.py' )
614614 os .remove (source )
615615 del sys .modules [TESTFN ]
616616 make_legacy_pyc (source )
@@ -1443,7 +1443,7 @@ def test_UNC_path(self):
14431443 self .fail ("could not import 'test_unc_path' from %r: %r"
14441444 % (unc , e ))
14451445 self .assertEqual (mod .testdata , 'test_unc_path' )
1446- self .assertTrue (mod .__file__ . startswith ( unc ), mod . __file__ )
1446+ self .assertStartsWith (mod .__file__ , unc )
14471447 unload ("test_unc_path" )
14481448
14491449
@@ -1456,7 +1456,7 @@ def tearDown(self):
14561456 def test_relimport_star (self ):
14571457 # This will import * from .test_import.
14581458 from .. import relimport
1459- self .assertTrue ( hasattr ( relimport , "RelativeImportTests" ) )
1459+ self .assertHasAttr ( relimport , "RelativeImportTests" )
14601460
14611461 def test_issue3221 (self ):
14621462 # Note for mergers: the 'absolute' tests from the 2.x branch
@@ -1786,15 +1786,15 @@ def test_frozen_importlib_is_bootstrap(self):
17861786 self .assertIs (mod , _bootstrap )
17871787 self .assertEqual (mod .__name__ , 'importlib._bootstrap' )
17881788 self .assertEqual (mod .__package__ , 'importlib' )
1789- self .assertTrue (mod .__file__ . endswith ( '_bootstrap.py' ), mod . __file__ )
1789+ self .assertEndsWith (mod .__file__ , '_bootstrap.py' )
17901790
17911791 def test_frozen_importlib_external_is_bootstrap_external (self ):
17921792 from importlib import _bootstrap_external
17931793 mod = sys .modules ['_frozen_importlib_external' ]
17941794 self .assertIs (mod , _bootstrap_external )
17951795 self .assertEqual (mod .__name__ , 'importlib._bootstrap_external' )
17961796 self .assertEqual (mod .__package__ , 'importlib' )
1797- self .assertTrue (mod .__file__ . endswith ( '_bootstrap_external.py' ), mod . __file__ )
1797+ self .assertEndsWith (mod .__file__ , '_bootstrap_external.py' )
17981798
17991799 def test_there_can_be_only_one (self ):
18001800 # Issue #15386 revealed a tricky loophole in the bootstrapping
@@ -2800,7 +2800,7 @@ def check_common(self, loaded):
28002800 self .assertEqual (mod .__file__ , self .FILE )
28012801 self .assertEqual (mod .__spec__ .origin , self .ORIGIN )
28022802 if not isolated :
2803- self .assertTrue ( issubclass ( mod .error , Exception ) )
2803+ self .assertIsSubclass ( mod .error , Exception )
28042804 self .assertEqual (mod .int_const , 1969 )
28052805 self .assertEqual (mod .str_const , 'something different' )
28062806 self .assertIsInstance (mod ._module_initialized , float )
0 commit comments