@@ -795,7 +795,15 @@ def testAssertHasAttr(self):
795795 with self .assertRaises (self .failureException ) as cm :
796796 self .assertHasAttr (a , 'y' )
797797 self .assertEqual (str (cm .exception ),
798- "List instance has no attribute 'y'" )
798+ "'List' object has no attribute 'y'" )
799+ with self .assertRaises (self .failureException ) as cm :
800+ self .assertHasAttr (List , 'spam' )
801+ self .assertEqual (str (cm .exception ),
802+ "type object 'List' has no attribute 'spam'" )
803+ with self .assertRaises (self .failureException ) as cm :
804+ self .assertHasAttr (sys , 'spam' )
805+ self .assertEqual (str (cm .exception ),
806+ "module 'sys' has no attribute 'spam'" )
799807
800808 with self .assertRaises (self .failureException ) as cm :
801809 self .assertHasAttr (a , 'y' , 'ababahalamaha' )
@@ -811,7 +819,15 @@ def testAssertNotHasAttr(self):
811819 with self .assertRaises (self .failureException ) as cm :
812820 self .assertNotHasAttr (a , 'x' )
813821 self .assertEqual (str (cm .exception ),
814- "List instance has unexpected attribute 'x'" )
822+ "'List' object has unexpected attribute 'x'" )
823+ with self .assertRaises (self .failureException ) as cm :
824+ self .assertNotHasAttr (List , 'append' )
825+ self .assertEqual (str (cm .exception ),
826+ "type object 'List' has unexpected attribute 'append'" )
827+ with self .assertRaises (self .failureException ) as cm :
828+ self .assertNotHasAttr (sys , 'modules' )
829+ self .assertEqual (str (cm .exception ),
830+ "module 'sys' has unexpected attribute 'modules'" )
815831
816832 with self .assertRaises (self .failureException ) as cm :
817833 self .assertNotHasAttr (a , 'x' , 'ababahalamaha' )
0 commit comments