1viktors_ingredients = ['чушки', 'домати', 'моркови', 'ябълки',
2 'сол', 'черен пипер', 'кимион', 'зехтин']
3georgis_ingredients = ('чушки', 'домати', 'патладжан', 'люти чушки',
4 'олио', 'захар', 'чубрица', 'черен пипер', 'врачанска ракия')
5shopping_list = viktors_ingredients
6
7for ingredient in georgis_ingredients:
8 shopping_list.append(ingredient)
9
10shopping_list = shopping_list[::-1]
11
12unique_ingredients = set(shopping_list)
13
14ingredient_quantities = {}
15
16for ingredient in unique_ingredients:
17 ingredient_quantities[ingredient] = 5
18
19ingredient_quantities['skyr'] = 1
20
21number_of_ingredients_to_buy = len(ingredient_quantities)
......F.
======================================================================
FAIL: test_viktors_ingredients (test.TestLyutenitsa.test_viktors_ingredients)
Viktor's ingredients should match the recipe.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 11, in test_viktors_ingredients
self.assertEqual(viktors_ingredients,
AssertionError: Lists differ: ['чуш[71 chars]хтин', 'чушки', 'домати', 'патладжан', 'люти ч[63 chars]кия'] != ['чуш[71 chars]хтин']
First list contains 9 additional elements.
First extra element 8:
'чушки'
['чушки',
'домати',
'моркови',
'ябълки',
'сол',
'черен пипер',
'кимион',
- 'зехтин',
? ^
+ 'зехтин']
? ^
- 'чушки',
- 'домати',
- 'патладжан',
- 'люти чушки',
- 'олио',
- 'захар',
- 'чубрица',
- 'черен пипер',
- 'врачанска ракия']
----------------------------------------------------------------------
Ran 8 tests in 0.001s
FAILED (failures=1)
t | 1 | viktors_ingredients = ['чушки', 'домати', 'моркови', 'ябълки', 'сол', 'черен пипер', 'кимион', 'зехтин'] | t | 1 | viktors_ingredients = ['чушки', 'домати', 'моркови', 'ябълки', |
2 | georgis_ingredients = ('чушки', 'домати', 'патладжан', 'люти чушки', 'олио', 'захар', 'чубрица', 'черен пипер', 'врачанска ракия') | 2 | 'сол', 'черен пипер', 'кимион', 'зехтин'] | ||
3 | georgis_ingredients = ('чушки', 'домати', 'патладжан', 'люти чушки', | ||||
4 | 'олио', 'захар', 'чубрица', 'черен пипер', 'врачанска ракия') | ||||
3 | shopping_list = viktors_ingredients | 5 | shopping_list = viktors_ingredients | ||
4 | 6 | ||||
5 | for ingredient in georgis_ingredients: | 7 | for ingredient in georgis_ingredients: | ||
6 | shopping_list.append(ingredient) | 8 | shopping_list.append(ingredient) | ||
7 | 9 | ||||
8 | shopping_list = shopping_list[::-1] | 10 | shopping_list = shopping_list[::-1] | ||
9 | 11 | ||||
10 | unique_ingredients = set(shopping_list) | 12 | unique_ingredients = set(shopping_list) | ||
11 | 13 | ||||
12 | ingredient_quantities = {} | 14 | ingredient_quantities = {} | ||
13 | 15 | ||||
14 | for ingredient in unique_ingredients: | 16 | for ingredient in unique_ingredients: | ||
15 | ingredient_quantities[ingredient] = 5 | 17 | ingredient_quantities[ingredient] = 5 | ||
16 | 18 | ||||
17 | ingredient_quantities['skyr'] = 1 | 19 | ingredient_quantities['skyr'] = 1 | ||
18 | 20 | ||||
19 | number_of_ingredients_to_buy = len(ingredient_quantities) | 21 | number_of_ingredients_to_buy = len(ingredient_quantities) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|