@@ -63,23 +63,23 @@ def test_nonexistent_object(self):
6363 with util .import_state (meta_path = [importer ]):
6464 module = self .__import__ ('module' , fromlist = ['non_existent' ])
6565 self .assertEqual (module .__name__ , 'module' )
66- self .assertFalse ( hasattr ( module , 'non_existent' ) )
66+ self .assertNotHasAttr ( module , 'non_existent' )
6767
6868 def test_module_from_package (self ):
6969 # [module]
7070 with util .mock_spec ('pkg.__init__' , 'pkg.module' ) as importer :
7171 with util .import_state (meta_path = [importer ]):
7272 module = self .__import__ ('pkg' , fromlist = ['module' ])
7373 self .assertEqual (module .__name__ , 'pkg' )
74- self .assertTrue ( hasattr ( module , 'module' ) )
74+ self .assertHasAttr ( module , 'module' )
7575 self .assertEqual (module .module .__name__ , 'pkg.module' )
7676
7777 def test_nonexistent_from_package (self ):
7878 with util .mock_spec ('pkg.__init__' ) as importer :
7979 with util .import_state (meta_path = [importer ]):
8080 module = self .__import__ ('pkg' , fromlist = ['non_existent' ])
8181 self .assertEqual (module .__name__ , 'pkg' )
82- self .assertFalse ( hasattr ( module , 'non_existent' ) )
82+ self .assertNotHasAttr ( module , 'non_existent' )
8383
8484 def test_module_from_package_triggers_ModuleNotFoundError (self ):
8585 # If a submodule causes an ModuleNotFoundError because it tries
@@ -107,7 +107,7 @@ def basic_star_test(self, fromlist=['*']):
107107 mock ['pkg' ].__all__ = ['module' ]
108108 module = self .__import__ ('pkg' , fromlist = fromlist )
109109 self .assertEqual (module .__name__ , 'pkg' )
110- self .assertTrue ( hasattr ( module , 'module' ) )
110+ self .assertHasAttr ( module , 'module' )
111111 self .assertEqual (module .module .__name__ , 'pkg.module' )
112112
113113 def test_using_star (self ):
@@ -125,8 +125,8 @@ def test_star_with_others(self):
125125 mock ['pkg' ].__all__ = ['module1' ]
126126 module = self .__import__ ('pkg' , fromlist = ['module2' , '*' ])
127127 self .assertEqual (module .__name__ , 'pkg' )
128- self .assertTrue ( hasattr ( module , 'module1' ) )
129- self .assertTrue ( hasattr ( module , 'module2' ) )
128+ self .assertHasAttr ( module , 'module1' )
129+ self .assertHasAttr ( module , 'module2' )
130130 self .assertEqual (module .module1 .__name__ , 'pkg.module1' )
131131 self .assertEqual (module .module2 .__name__ , 'pkg.module2' )
132132
@@ -136,15 +136,15 @@ def test_nonexistent_in_all(self):
136136 importer ['pkg' ].__all__ = ['non_existent' ]
137137 module = self .__import__ ('pkg' , fromlist = ['*' ])
138138 self .assertEqual (module .__name__ , 'pkg' )
139- self .assertFalse ( hasattr ( module , 'non_existent' ) )
139+ self .assertNotHasAttr ( module , 'non_existent' )
140140
141141 def test_star_in_all (self ):
142142 with util .mock_spec ('pkg.__init__' ) as importer :
143143 with util .import_state (meta_path = [importer ]):
144144 importer ['pkg' ].__all__ = ['*' ]
145145 module = self .__import__ ('pkg' , fromlist = ['*' ])
146146 self .assertEqual (module .__name__ , 'pkg' )
147- self .assertFalse ( hasattr ( module , '*' ) )
147+ self .assertNotHasAttr ( module , '*' )
148148
149149 def test_invalid_type (self ):
150150 with util .mock_spec ('pkg.__init__' ) as importer :
0 commit comments