@@ -13,8 +13,8 @@ def test_creating_lists_with_list_comprehensions(self):
13
13
14
14
comprehension = [delicacy .capitalize () for delicacy in feast ]
15
15
16
- # self.assertEqual(__, comprehension[0])
17
- # self.assertEqual(__, comprehension[2])
16
+ self .assertEqual (__ , comprehension [0 ])
17
+ self .assertEqual (__ , comprehension [2 ])
18
18
19
19
def test_filtering_lists_with_list_comprehensions (self ):
20
20
feast = ['spam' , 'sloths' , 'orangutans' , 'breakfast cereals' ,
@@ -30,31 +30,32 @@ def test_unpacking_tuples_in_list_comprehensions(self):
30
30
comprehension = [ skit * number for number , skit in list_of_tuples ]
31
31
32
32
self .assertEqual (__ , comprehension [0 ])
33
- self .assertEqual (__ , len ( comprehension [2 ]) )
33
+ self .assertEqual (__ , comprehension [2 ])
34
34
35
- def test_double_list_comprehention (self ):
35
+ def test_double_list_comprehension (self ):
36
36
list_of_eggs = ['poached egg' , 'fried egg' ]
37
37
list_of_meats = ['lite spam' , 'ham spam' , 'fried spam' ]
38
38
39
39
40
40
comprehension = [ '{0} and {1}' .format (egg , meat ) for egg in list_of_eggs for meat in list_of_meats ]
41
41
42
42
43
- self .assertEqual (__ , len (comprehension ))
44
43
self .assertEqual (__ , comprehension [0 ])
44
+ self .assertEqual (__ , len (comprehension ))
45
45
46
- def test_creating_a_set_with_set_comprehention (self ):
46
+ def test_creating_a_set_with_set_comprehension (self ):
47
47
comprehension = { x for x in 'aabbbcccc' }
48
48
49
- self .assertequal (__ , len ( comprehension ) ) # remeber that set members are unique
49
+ self .assertEqual (__ , comprehension ) # remeber that set members are unique
50
50
51
- def test_creating_a_dictionary_with_dictionary_comprehention (self ):
51
+ def test_creating_a_dictionary_with_dictionary_comprehension (self ):
52
52
dict_of_weapons = {'first' : 'fear' , 'second' : 'surprise' ,
53
- 'third' :'ruthless efficiency' , 'forth' :'fanatical devotion' , 'fifth' : None }
53
+ 'third' :'ruthless efficiency' , 'forth' :'fanatical devotion' ,
54
+ 'fifth' : None }
54
55
55
- dict_comprehention = { k .upper (): weapon for k , weapon in dict_of_weapons .iteritems () if weapon }
56
+ dict_comprehension = { k .upper (): weapon for k , weapon in dict_of_weapons .items () if weapon }
56
57
57
- self .assertEqual (__ , 'first' in dict_comprehention )
58
- self .assertEqual (__ , 'FIRST' in dict_comprehention )
58
+ self .assertEqual (__ , 'first' in dict_comprehension )
59
+ self .assertEqual (__ , 'FIRST' in dict_comprehension )
59
60
self .assertEqual (__ , len (dict_of_weapons ))
60
- self .assertEqual (__ , len (dict_comprehention ))
61
+ self .assertEqual (__ , len (dict_comprehension ))
0 commit comments