@@ -17,36 +17,36 @@ def test_new_style_class_objects_are_objects(self):
1717 # phased out in Python 3.
1818
1919 fido = self .Dog ()
20- self .assertEqual (__ , isinstance (fido , object ))
20+ self .assertEqual (True , isinstance (fido , object ))
2121
2222 def test_classes_are_types (self ):
23- self .assertEqual (__ , self .Dog .__class__ == type )
23+ self .assertEqual (True , self .Dog .__class__ == type )
2424
2525 def test_classes_are_objects_too (self ):
26- self .assertEqual (__ , issubclass (self .Dog , object ))
26+ self .assertEqual (True , issubclass (self .Dog , object ))
2727
2828 def test_objects_have_methods (self ):
2929 fido = self .Dog ()
30- self .assertEqual (__ , len (dir (fido )))
30+ self .assertEqual (18 , len (dir (fido )))
3131
3232 def test_classes_have_methods (self ):
33- self .assertEqual (__ , len (dir (self .Dog )))
33+ self .assertEqual (18 , len (dir (self .Dog )))
3434
3535 def test_creating_objects_without_defining_a_class (self ):
3636 singularity = object ()
37- self .assertEqual (__ , len (dir (singularity )))
37+ self .assertEqual (15 , len (dir (singularity )))
3838
3939 def test_defining_attributes_on_individual_objects (self ):
4040 fido = self .Dog ()
4141 fido .legs = 4
4242
43- self .assertEqual (__ , fido .legs )
43+ self .assertEqual (4 , fido .legs )
4444
4545 def test_defining_functions_on_individual_objects (self ):
4646 fido = self .Dog ()
4747 fido .wag = lambda : 'fidos wag'
4848
49- self .assertEqual (__ , fido .wag ())
49+ self .assertEqual ('fidos wag' , fido .wag ())
5050
5151 def test_other_objects_are_not_affected_by_these_singleton_functions (self ):
5252 fido = self .Dog ()
@@ -59,7 +59,7 @@ def wag():
5959 try :
6060 rover .wag ()
6161 except Exception as ex :
62- self .assertMatch (__ , ex [0 ])
62+ self .assertMatch ("'Dog' object has no attribute 'wag'" , ex [0 ])
6363
6464 # ------------------------------------------------------------------
6565
@@ -82,19 +82,19 @@ def growl(cls):
8282 return "classmethod growl, arg: cls=" + cls .__name__
8383
8484 def test_like_all_objects_classes_can_have_singleton_methods (self ):
85- self .assertMatch (__ , self .Dog2 .growl ())
85+ self .assertMatch ("classmethod growl, arg: cls=Dog2" , self .Dog2 .growl ())
8686
8787 def test_classmethods_are_not_independent_of_instance_methods (self ):
8888 fido = self .Dog2 ()
89- self .assertMatch (__ , fido .growl ())
90- self .assertMatch (__ , self .Dog2 .growl ())
89+ self .assertMatch ("classmethod growl, arg: cls=Dog2" , fido .growl ())
90+ self .assertMatch ("classmethod growl, arg: cls=Dog2" , self .Dog2 .growl ())
9191
9292 def test_staticmethods_are_unbound_functions_housed_in_a_class (self ):
93- self .assertMatch (__ , self .Dog2 .bark ())
93+ self .assertMatch ("staticmethod bark, arg: None" , self .Dog2 .bark ())
9494
9595 def test_staticmethods_also_overshadow_instance_methods (self ):
9696 fido = self .Dog2 ()
97- self .assertMatch (__ , fido .bark ())
97+ self .assertMatch ("staticmethod bark, arg: None" , fido .bark ())
9898
9999 # ------------------------------------------------------------------
100100
@@ -125,20 +125,20 @@ def test_classmethods_can_not_be_used_as_properties(self):
125125 try :
126126 fido .name = "Fido"
127127 except Exception as ex :
128- self .assertMatch (__ , ex [0 ])
128+ self .assertMatch ("'classmethod' object is not callable" , ex [0 ])
129129
130130 def test_classes_and_instances_do_not_share_instance_attributes (self ):
131131 fido = self .Dog3 ()
132132 fido .set_name_from_instance ("Fido" )
133133 fido .set_name ("Rover" )
134- self .assertEqual (__ , fido .get_name_from_instance ())
135- self .assertEqual (__ , self .Dog3 .get_name ())
134+ self .assertEqual ("Fido" , fido .get_name_from_instance ())
135+ self .assertEqual ("Rover" , self .Dog3 .get_name ())
136136
137137 def test_classes_and_instances_do_share_class_attributes (self ):
138138 fido = self .Dog3 ()
139139 fido .set_name ("Fido" )
140- self .assertEqual (__ , fido .get_name ())
141- self .assertEqual (__ , self .Dog3 .get_name ())
140+ self .assertEqual ("Fido" , fido .get_name ())
141+ self .assertEqual ("Fido" , self .Dog3 .get_name ())
142142
143143 # ------------------------------------------------------------------
144144
@@ -153,13 +153,13 @@ def a_static_method():
153153 a_static_method = staticmethod (a_static_method )
154154
155155 def test_you_can_define_class_methods_without_using_a_decorator (self ):
156- self .assertEqual (__ , self .Dog4 .a_class_method ())
156+ self .assertEqual ("dogs class method" , self .Dog4 .a_class_method ())
157157
158158 def test_you_can_define_static_methods_without_using_a_decorator (self ):
159- self .assertEqual (__ , self .Dog4 .a_static_method ())
159+ self .assertEqual ("dogs static method" , self .Dog4 .a_static_method ())
160160
161161 # ------------------------------------------------------------------
162162
163163 def test_you_can_explicitly_call_class_methods_from_instance_methods (self ):
164164 fido = self .Dog4 ()
165- self .assertEqual (__ , fido .__class__ .a_class_method ())
165+ self .assertEqual ("dogs class method" , fido .__class__ .a_class_method ())
0 commit comments