@@ -10,38 +10,38 @@ def test_use_format_to_interpolate_variables(self):
1010 value1 = 'one'
1111 value2 = 2
1212 string = "The values are {0} and {1}" .format (value1 , value2 )
13- self .assertEqual (__ , string )
13+ self .assertEqual ("The values are one and 2" , string )
1414
1515 def test_formatted_values_can_be_shown_in_any_order_or_be_repeated (self ):
1616 value1 = 'doh'
1717 value2 = 'DOH'
1818 string = "The values are {1}, {0}, {0} and {1}!" .format (value1 , value2 )
19- self .assertEqual (__ , string )
19+ self .assertEqual ("The values are DOH, doh, doh and DOH!" , string )
2020
2121 def test_any_python_expression_may_be_interpolated (self ):
2222 import math # import a standard python module with math functions
2323
2424 decimal_places = 4
2525 string = "The square root of 5 is {0:.{1}f}" .format (math .sqrt (5 ), \
2626 decimal_places )
27- self .assertEqual (__ , string )
27+ self .assertEqual ("The square root of 5 is 2.2361" , string )
2828
2929 def test_you_can_get_a_substring_from_a_string (self ):
3030 string = "Bacon, lettuce and tomato"
31- self .assertEqual (__ , string [7 :10 ])
31+ self .assertEqual ('let' , string [7 :10 ])
3232
3333 def test_you_can_get_a_single_character_from_a_string (self ):
3434 string = "Bacon, lettuce and tomato"
35- self .assertEqual (__ , string [1 ])
35+ self .assertEqual ('a' , string [1 ])
3636
3737 def test_single_characters_can_be_represented_by_integers (self ):
38- self .assertEqual (__ , ord ('a' ))
39- self .assertEqual (__ , ord ('b' ) == (ord ('a' ) + 1 ))
38+ self .assertEqual (97 , ord ('a' ))
39+ self .assertEqual (True , ord ('b' ) == (ord ('a' ) + 1 ))
4040
4141 def test_strings_can_be_split (self ):
4242 string = "Sausage Egg Cheese"
4343 words = string .split ()
44- self .assertEqual ([__ , __ , __ ], words )
44+ self .assertEqual (['Sausage' , 'Egg' , 'Cheese' ], words )
4545
4646 def test_strings_can_be_split_with_different_patterns (self ):
4747 import re # import python regular expression library
@@ -51,26 +51,26 @@ def test_strings_can_be_split_with_different_patterns(self):
5151
5252 words = pattern .split (string )
5353
54- self .assertEqual ([__ , __ , __ , __ ], words )
54+ self .assertEqual (['the' , 'rain' , 'in' , 'spain' ], words )
5555
5656 # `pattern` is a Python regular expression pattern which matches
5757 # ',' or ';'
5858
5959 def test_raw_strings_do_not_interpret_escape_characters (self ):
6060 string = r'\n'
6161 self .assertNotEqual ('\n ' , string )
62- self .assertEqual (__ , string )
63- self .assertEqual (__ , len (string ))
62+ self .assertEqual (' \\ n' , string )
63+ self .assertEqual (2 , len (string ))
6464
6565 # Useful in regular expressions, file paths, URLs, etc.
6666
6767 def test_strings_can_be_joined (self ):
6868 words = ["Now" , "is" , "the" , "time" ]
69- self .assertEqual (__ , ' ' .join (words ))
69+ self .assertEqual ("Now is the time" , ' ' .join (words ))
7070
7171 def test_strings_can_change_case (self ):
72- self .assertEqual (__ , 'guido' .capitalize ())
73- self .assertEqual (__ , 'guido' .upper ())
74- self .assertEqual (__ , 'TimBot' .lower ())
75- self .assertEqual (__ , 'guido van rossum' .title ())
76- self .assertEqual (__ , 'ToTaLlY aWeSoMe' .swapcase ())
72+ self .assertEqual ('Guido' , 'guido' .capitalize ())
73+ self .assertEqual ('GUIDO' , 'guido' .upper ())
74+ self .assertEqual ('timbot' , 'TimBot' .lower ())
75+ self .assertEqual ('Guido Van Rossum' , 'guido van rossum' .title ())
76+ self .assertEqual ('tOtAlLy AwEsOmE' , 'ToTaLlY aWeSoMe' .swapcase ())
0 commit comments