@@ -23,31 +23,31 @@ def bark(self):
23
23
return "yip"
24
24
25
25
def test_subclasses_have_the_parent_as_an_ancestor (self ):
26
- self .assertEqual (__ , issubclass (self .Chihuahua , self .Dog ))
26
+ self .assertEqual (True , issubclass (self .Chihuahua , self .Dog ))
27
27
28
28
def test_all_classes_in_python_3_ultimately_inherit_from_object_class (self ):
29
- self .assertEqual (__ , issubclass (self .Chihuahua , object ))
29
+ self .assertEqual (True , issubclass (self .Chihuahua , object ))
30
30
31
31
# Note: This isn't the case in Python 2. In that version you have
32
32
# to inherit from a built in class or object explicitly
33
33
34
34
def test_instances_inherit_behavior_from_parent_class (self ):
35
35
chico = self .Chihuahua ("Chico" )
36
- self .assertEqual (__ , chico .name )
36
+ self .assertEqual ("Chico" , chico .name )
37
37
38
38
def test_subclasses_add_new_behavior (self ):
39
39
chico = self .Chihuahua ("Chico" )
40
- self .assertEqual (__ , chico .wag ())
40
+ self .assertEqual ("happy" , chico .wag ())
41
41
42
42
fido = self .Dog ("Fido" )
43
- with self .assertRaises (___ ): fido .wag ()
43
+ with self .assertRaises (AttributeError ): fido .wag ()
44
44
45
45
def test_subclasses_can_modify_existing_behavior (self ):
46
46
chico = self .Chihuahua ("Chico" )
47
- self .assertEqual (__ , chico .bark ())
47
+ self .assertEqual ("yip" , chico .bark ())
48
48
49
49
fido = self .Dog ("Fido" )
50
- self .assertEqual (__ , fido .bark ())
50
+ self .assertEqual ("WOOF" , fido .bark ())
51
51
52
52
# ------------------------------------------------------------------
53
53
@@ -58,7 +58,7 @@ def bark(self):
58
58
59
59
def test_subclasses_can_invoke_parent_behavior_via_super (self ):
60
60
ralph = self .BullDog ("Ralph" )
61
- self .assertEqual (__ , ralph .bark ())
61
+ self .assertEqual ("WOOF, GRR" , ralph .bark ())
62
62
63
63
# ------------------------------------------------------------------
64
64
@@ -68,7 +68,7 @@ def growl(self):
68
68
69
69
def test_super_works_across_methods (self ):
70
70
george = self .GreatDane ("George" )
71
- self .assertEqual (__ , george .growl ())
71
+ self .assertEqual ("WOOF, GROWL" , george .growl ())
72
72
73
73
# ---------------------------------------------------------
74
74
@@ -82,8 +82,8 @@ def __init__(self, name):
82
82
83
83
def test_base_init_does_not_get_called_automatically (self ):
84
84
snoopy = self .Pug ("Snoopy" )
85
- with self .assertRaises (___ ): name = snoopy .name
85
+ with self .assertRaises (AttributeError ): name = snoopy .name
86
86
87
87
def test_base_init_has_to_be_called_explicitly (self ):
88
88
boxer = self .Greyhound ("Boxer" )
89
- self .assertEqual (__ , boxer .name )
89
+ self .assertEqual ("Boxer" , boxer .name )
0 commit comments