@@ -9,38 +9,38 @@ def test_use_format_to_interpolate_variables(self):
99 value1 = 'one'
1010 value2 = 2
1111 string = "The values are {0} and {1}" .format (value1 , value2 )
12- self .assertEqual (__ , string )
12+ self .assertEqual ("The values are one and 2" , string )
1313
1414 def test_formatted_values_can_be_shown_in_any_order_or_be_repeated (self ):
1515 value1 = 'doh'
1616 value2 = 'DOH'
1717 string = "The values are {1}, {0}, {0} and {1}!" .format (value1 , value2 )
18- self .assertEqual (__ , string )
18+ self .assertEqual ("The values are DOH, doh, doh and DOH!" , string )
1919
2020 def test_any_python_expression_may_be_interpolated (self ):
2121 import math # import a standard python module with math functions
2222
2323 decimal_places = 4
2424 string = "The square root of 5 is {0:.{1}f}" .format (math .sqrt (5 ),
2525 decimal_places )
26- self .assertEqual (__ , string )
26+ self .assertEqual ("The square root of 5 is 2.2361" , string )
2727
2828 def test_you_can_get_a_substring_from_a_string (self ):
2929 string = "Bacon, lettuce and tomato"
30- self .assertEqual (__ , string [7 :10 ])
30+ self .assertEqual ("let" , string [7 :10 ])
3131
3232 def test_you_can_get_a_single_character_from_a_string (self ):
3333 string = "Bacon, lettuce and tomato"
34- self .assertEqual (__ , string [1 ])
34+ self .assertEqual ("a" , string [1 ])
3535
3636 def test_single_characters_can_be_represented_by_integers (self ):
37- self .assertEqual (__ , ord ('a' ))
38- self .assertEqual (__ , ord ('b' ) == (ord ('a' ) + 1 ))
37+ self .assertEqual (97 , ord ('a' ))
38+ self .assertEqual (True , ord ('b' ) == (ord ('a' ) + 1 ))
3939
4040 def test_strings_can_be_split (self ):
4141 string = "Sausage Egg Cheese"
4242 words = string .split ()
43- self .assertListEqual ([__ , __ , __ ], words )
43+ self .assertListEqual (["Sausage" , "Egg" , "Cheese" ], words )
4444
4545 def test_strings_can_be_split_with_different_patterns (self ):
4646 import re #import python regular expression library
@@ -50,25 +50,25 @@ def test_strings_can_be_split_with_different_patterns(self):
5050
5151 words = pattern .split (string )
5252
53- self .assertListEqual ([__ , __ , __ , __ ], words )
53+ self .assertListEqual (["the" , "rain" , "in" , "spain" ], words )
5454
5555 # Pattern is a Python regular expression pattern which matches ',' or ';'
5656
5757 def test_raw_strings_do_not_interpret_escape_characters (self ):
5858 string = r'\n'
5959 self .assertNotEqual ('\n ' , string )
60- self .assertEqual (__ , string )
61- self .assertEqual (__ , len (string ))
60+ self .assertEqual (' \\ n' , string )
61+ self .assertEqual (2 , len (string ))
6262
6363 # Useful in regular expressions, file paths, URLs, etc.
6464
6565 def test_strings_can_be_joined (self ):
6666 words = ["Now" , "is" , "the" , "time" ]
67- self .assertEqual (__ , ' ' .join (words ))
67+ self .assertEqual ("Now is the time" , ' ' .join (words ))
6868
6969 def test_strings_can_change_case (self ):
70- self .assertEqual (__ , 'guido' .capitalize ())
71- self .assertEqual (__ , 'guido' .upper ())
72- self .assertEqual (__ , 'TimBot' .lower ())
73- self .assertEqual (__ , 'guido van rossum' .title ())
74- self .assertEqual (__ , 'ToTaLlY aWeSoMe' .swapcase ())
70+ self .assertEqual ("Guido" , 'guido' .capitalize ())
71+ self .assertEqual ("GUIDO" , 'guido' .upper ())
72+ self .assertEqual ("timbot" , 'TimBot' .lower ())
73+ self .assertEqual ("Guido Van Rossum" , 'guido van rossum' .title ())
74+ self .assertEqual ("tOtAlLy AwEsOmE" , 'ToTaLlY aWeSoMe' .swapcase ())
0 commit comments