@@ -795,7 +795,15 @@ def testAssertHasAttr(self):
795
795
with self .assertRaises (self .failureException ) as cm :
796
796
self .assertHasAttr (a , 'y' )
797
797
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'" )
799
807
800
808
with self .assertRaises (self .failureException ) as cm :
801
809
self .assertHasAttr (a , 'y' , 'ababahalamaha' )
@@ -811,7 +819,15 @@ def testAssertNotHasAttr(self):
811
819
with self .assertRaises (self .failureException ) as cm :
812
820
self .assertNotHasAttr (a , 'x' )
813
821
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'" )
815
831
816
832
with self .assertRaises (self .failureException ) as cm :
817
833
self .assertNotHasAttr (a , 'x' , 'ababahalamaha' )
0 commit comments