Домашни > Функцията, която казва "Ni!" > Решения > Решението на Илиан Запрянов

Резултати
10 точки от тестове
0 точки от учител

10 точки общо

10 успешни теста
0 неуспешни теста
Код

  1#keys for bushes
  2bushes_keys = ('храст', 'shrub', 'bush',)
  3
  4#check if argument is a valid bush
  5def is_bush(arg):
  6    if type(arg) != dict or 'name' not in arg:
  7        return False
  8
  9    if arg['name'].lower() not in bushes_keys:
 10        return False
 11
 12    return True
 13
 14#check if the multitude of bushes is valid
 15def is_pretty_bush(price, unique_letters):
 16    if int(price) == 0:
 17        return False
 18    
 19    return len(unique_letters) % int(price) == 0 and price <= 42.00
 20
 21def function_that_says_ni(*args, **kwargs):
 22    
 23    price = 0.00
 24
 25    #iterate positioned args
 26    for positioned in args:
 27        if is_bush(positioned):
 28            if 'cost' in positioned:
 29                price += positioned['cost']
 30    
 31    #iterate named args
 32    for named in kwargs.values():
 33        if is_bush(named):
 34            if 'cost' in named:
 35                price += named['cost']
 36
 37    #get unique characters found in the bushes in the multitude
 38    unique_letters = set(''.join([key for key, value in kwargs.items() if is_bush(value)]))
 39
 40    if is_pretty_bush(price, unique_letters):
 41        return f'{price:.2f}лв'
 42    return 'Ni!'
 43
 44# import unittest
 45# from function_that_says_ni import function_that_says_ni 
 46
 47# class TestFunctionThatSaysNi(unittest.TestCase):
 48    
 49#     def test_valid_bushes_with_cost(self):
 50#         self.assertEqual(function_that_says_ni({"name": "храст", "cost": 1.50}, {"name": "sHRub", "cost": 3.00}), "4.50лв")
 51#         self.assertEqual(function_that_says_ni({"name": "хРАст", "cost": 150}, {"name": "shrub", "cost": 3.00}), "Ni!")
 52
 53#     def test_invalid_bushes(self):
 54#         self.assertEqual(function_that_says_ni({"ddd": "храст", "cost": 1.50}, {"namae": "sHRub", "cost": 3.00}), "Ni!")
 55#         self.assertEqual(function_that_says_ni({"namdde": "хРАст", "cost": 150}, {"namse": "shrub", "cost": 3.00}), "Ni!")
 56
 57#     def test_invalid_bushes_with_cost(self):
 58#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 244.00}), "Ni!")
 59#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храстченце", "cost": 2.00}), "Ni!")
 60#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 41.99}), "41.99лв")
 61
 62#     def test_valid_bushes_without_cost(self):
 63#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "buSh"}), "Ni!")
 64#         self.assertEqual(function_that_says_ni(a={"name": "храст"}, b={"name": "shrub"}), "Ni!")
 65
 66#     def test_invalid_bushes_without_cost(self):
 67#         self.assertEqual(function_that_says_ni({"name": "храст44"}, {"name": "bus44h"}), "Ni!")
 68#         self.assertEqual(function_that_says_ni(a={"name": "храс124т"}, b={"name": "s52hrub"}), "Ni!")
 69
 70#     def test_valid_bushes_with_and_without_cost(self):
 71#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "bush", "cost": 33.33}), "33.33лв")
 72#         self.assertEqual(function_that_says_ni(a={"name": "храст", "cost": 17}, b={"name": "shrub"}), "Ni!")
 73
 74#     def test_not_pretty_bushes_due_to_price(self):
 75#         self.assertEqual(function_that_says_ni({"name": "храсТ", "cost": 50.0}), "Ni!")
 76#         self.assertEqual(function_that_says_ni({"name": "shrub", "cost": 43.00}), "Ni!")
 77
 78#     def test_not_pretty_bushes_due_to_unique_letters(self):
 79#         self.assertEqual(function_that_says_ni(ad={"name": "храст", "cost": 1.80}, b={"name": "храст", "cost": 1}), "Ni!")
 80#         self.assertEqual(function_that_says_ni(a={"name": "буш"}, b={"name": "шрасх"}), "Ni!")
 81
 82#     def test_mixed_types(self):
 83#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 0.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "1.80лв")
 84#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 30.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")
 85#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")  
 86#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}, da=(1,2)), "Ni!")  
 87#        self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "храст", "cost": 0.0}, ["ffffffffff", {1, 2, 3}]), "Ni!") 
 88    
 89#     def test_all_in_one_first_variation(self):
 90#        self.assertEqual(function_that_says_ni(4, 4, {"name": "ХРраст", "cost": 10.0}, [3,4,5], ad={"name": "хРаст", "cost": 1.80}, da = "pypy"), "1.80лв")
 91#        self.assertEqual(function_that_says_ni(4, 4, {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")
 92#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")
 93
 94#     def test_all_in_one_second_variation(self):
 95#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "11.00лв")
 96#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "bush", "cost": 1.80}, c = "pypy"), "Ni!")
 97#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 12.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "12.00лв")
 98        
 99# if __name__ == '__main__':
100#     unittest.main()

..........
----------------------------------------------------------------------
Ran 10 tests in 0.000s

OK

Дискусия
Илиан Запрянов
18.10.2024 13:07

не съм сигурен дали са верни иначе прайм🤜🏼🤛🏼
Виктор Бечев
18.10.2024 12:27

Имах и коментар за точката, ама ме изпревари, та го изтрих. :grin:
Виктор Бечев
18.10.2024 12:25

Ако: 1. Имаш желание. 2. Kачиш тестовете на някакъв pastebin тип сайт. 3. Ги споделиш с колегите си _(като линк в коментар към домашното)_. Ще: 1. Получиш бонус точка. 2. Помогнеш на колегите си. 3. Спечелиш street cred.
История

f1#keys for bushesf1#keys for bushes
2bushes_keys = ('храст', 'shrub', 'bush',)2bushes_keys = ('храст', 'shrub', 'bush',)
33
4#check if argument is a valid bush4#check if argument is a valid bush
5def is_bush(arg):5def is_bush(arg):
6    if type(arg) != dict or 'name' not in arg:6    if type(arg) != dict or 'name' not in arg:
7        return False7        return False
88
9    if arg['name'].lower() not in bushes_keys:9    if arg['name'].lower() not in bushes_keys:
10        return False10        return False
1111
12    return True12    return True
1313
14#check if the multitude of bushes is valid14#check if the multitude of bushes is valid
15def is_pretty_bush(price, unique_letters):15def is_pretty_bush(price, unique_letters):
16    if int(price) == 0:16    if int(price) == 0:
17        return False17        return False
18    18    
19    return len(unique_letters) % int(price) == 0 and price <= 42.0019    return len(unique_letters) % int(price) == 0 and price <= 42.00
2020
21def function_that_says_ni(*args, **kwargs):21def function_that_says_ni(*args, **kwargs):
22    22    
23    price = 0.0023    price = 0.00
2424
25    #iterate positioned args25    #iterate positioned args
26    for positioned in args:26    for positioned in args:
27        if is_bush(positioned):27        if is_bush(positioned):
28            if 'cost' in positioned:28            if 'cost' in positioned:
29                price += positioned['cost']29                price += positioned['cost']
30    30    
31    #iterate named args31    #iterate named args
32    for named in kwargs.values():32    for named in kwargs.values():
33        if is_bush(named):33        if is_bush(named):
34            if 'cost' in named:34            if 'cost' in named:
35                price += named['cost']35                price += named['cost']
3636
37    #get unique characters found in the bushes in the multitude37    #get unique characters found in the bushes in the multitude
38    unique_letters = set(''.join([key for key, value in kwargs.items() if is_bush(value)]))38    unique_letters = set(''.join([key for key, value in kwargs.items() if is_bush(value)]))
3939
40    if is_pretty_bush(price, unique_letters):40    if is_pretty_bush(price, unique_letters):
n41        return f'{price:.2f}лв.'n41        return f'{price:.2f}лв'
42    return 'Ni!'42    return 'Ni!'
4343
44# import unittest44# import unittest
45# from function_that_says_ni import function_that_says_ni 45# from function_that_says_ni import function_that_says_ni 
4646
47# class TestFunctionThatSaysNi(unittest.TestCase):47# class TestFunctionThatSaysNi(unittest.TestCase):
48    48    
49#     def test_valid_bushes_with_cost(self):49#     def test_valid_bushes_with_cost(self):
n50#         self.assertEqual(function_that_says_ni({"name": "храст", "cost": 1.50}, {"name": "sHRub", "cost": 3.00}), "4.50лв.")n50#         self.assertEqual(function_that_says_ni({"name": "храст", "cost": 1.50}, {"name": "sHRub", "cost": 3.00}), "4.50лв")
51#         self.assertEqual(function_that_says_ni({"name": "хРАст", "cost": 150}, {"name": "shrub", "cost": 3.00}), "Ni!")51#         self.assertEqual(function_that_says_ni({"name": "хРАст", "cost": 150}, {"name": "shrub", "cost": 3.00}), "Ni!")
5252
53#     def test_invalid_bushes(self):53#     def test_invalid_bushes(self):
54#         self.assertEqual(function_that_says_ni({"ddd": "храст", "cost": 1.50}, {"namae": "sHRub", "cost": 3.00}), "Ni!")54#         self.assertEqual(function_that_says_ni({"ddd": "храст", "cost": 1.50}, {"namae": "sHRub", "cost": 3.00}), "Ni!")
55#         self.assertEqual(function_that_says_ni({"namdde": "хРАст", "cost": 150}, {"namse": "shrub", "cost": 3.00}), "Ni!")55#         self.assertEqual(function_that_says_ni({"namdde": "хРАст", "cost": 150}, {"namse": "shrub", "cost": 3.00}), "Ni!")
5656
57#     def test_invalid_bushes_with_cost(self):57#     def test_invalid_bushes_with_cost(self):
58#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 244.00}), "Ni!")58#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 244.00}), "Ni!")
59#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храстченце", "cost": 2.00}), "Ni!")59#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храстченце", "cost": 2.00}), "Ni!")
n60#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 41.99}), "41.99лв.")n60#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 41.99}), "41.99лв")
6161
62#     def test_valid_bushes_without_cost(self):62#     def test_valid_bushes_without_cost(self):
63#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "buSh"}), "Ni!")63#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "buSh"}), "Ni!")
64#         self.assertEqual(function_that_says_ni(a={"name": "храст"}, b={"name": "shrub"}), "Ni!")64#         self.assertEqual(function_that_says_ni(a={"name": "храст"}, b={"name": "shrub"}), "Ni!")
6565
66#     def test_invalid_bushes_without_cost(self):66#     def test_invalid_bushes_without_cost(self):
67#         self.assertEqual(function_that_says_ni({"name": "храст44"}, {"name": "bus44h"}), "Ni!")67#         self.assertEqual(function_that_says_ni({"name": "храст44"}, {"name": "bus44h"}), "Ni!")
68#         self.assertEqual(function_that_says_ni(a={"name": "храс124т"}, b={"name": "s52hrub"}), "Ni!")68#         self.assertEqual(function_that_says_ni(a={"name": "храс124т"}, b={"name": "s52hrub"}), "Ni!")
6969
70#     def test_valid_bushes_with_and_without_cost(self):70#     def test_valid_bushes_with_and_without_cost(self):
n71#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "bush", "cost": 33.33}), "33.33лв.")n71#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "bush", "cost": 33.33}), "33.33лв")
72#         self.assertEqual(function_that_says_ni(a={"name": "храст", "cost": 17}, b={"name": "shrub"}), "Ni!")72#         self.assertEqual(function_that_says_ni(a={"name": "храст", "cost": 17}, b={"name": "shrub"}), "Ni!")
7373
74#     def test_not_pretty_bushes_due_to_price(self):74#     def test_not_pretty_bushes_due_to_price(self):
75#         self.assertEqual(function_that_says_ni({"name": "храсТ", "cost": 50.0}), "Ni!")75#         self.assertEqual(function_that_says_ni({"name": "храсТ", "cost": 50.0}), "Ni!")
76#         self.assertEqual(function_that_says_ni({"name": "shrub", "cost": 43.00}), "Ni!")76#         self.assertEqual(function_that_says_ni({"name": "shrub", "cost": 43.00}), "Ni!")
7777
78#     def test_not_pretty_bushes_due_to_unique_letters(self):78#     def test_not_pretty_bushes_due_to_unique_letters(self):
79#         self.assertEqual(function_that_says_ni(ad={"name": "храст", "cost": 1.80}, b={"name": "храст", "cost": 1}), "Ni!")79#         self.assertEqual(function_that_says_ni(ad={"name": "храст", "cost": 1.80}, b={"name": "храст", "cost": 1}), "Ni!")
80#         self.assertEqual(function_that_says_ni(a={"name": "буш"}, b={"name": "шрасх"}), "Ni!")80#         self.assertEqual(function_that_says_ni(a={"name": "буш"}, b={"name": "шрасх"}), "Ni!")
8181
82#     def test_mixed_types(self):82#     def test_mixed_types(self):
n83#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 0.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "1.80лв.")n83#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 0.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "1.80лв")
84#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 30.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")84#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 30.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")
85#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")  85#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")  
86#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}, da=(1,2)), "Ni!")  86#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}, da=(1,2)), "Ni!")  
87#        self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "храст", "cost": 0.0}, ["ffffffffff", {1, 2, 3}]), "Ni!") 87#        self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "храст", "cost": 0.0}, ["ffffffffff", {1, 2, 3}]), "Ni!") 
88    88    
89#     def test_all_in_one_first_variation(self):89#     def test_all_in_one_first_variation(self):
n90#        self.assertEqual(function_that_says_ni(4, 4, {"name": "ХРраст", "cost": 10.0}, [3,4,5], ad={"name": "хРаст", "cost": 1.80}, da = "pypy"), "1.80лв.")n90#        self.assertEqual(function_that_says_ni(4, 4, {"name": "ХРраст", "cost": 10.0}, [3,4,5], ad={"name": "хРаст", "cost": 1.80}, da = "pypy"), "1.80лв")
91#        self.assertEqual(function_that_says_ni(4, 4, {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")91#        self.assertEqual(function_that_says_ni(4, 4, {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")
92#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")92#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")
9393
94#     def test_all_in_one_second_variation(self):94#     def test_all_in_one_second_variation(self):
n95#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "11.00лв.")n95#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "11.00лв")
96#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "bush", "cost": 1.80}, c = "pypy"), "Ni!")96#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "bush", "cost": 1.80}, c = "pypy"), "Ni!")
t97#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 12.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "12.00лв.")t97#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 12.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "12.00лв")
98        98        
99# if __name__ == '__main__':99# if __name__ == '__main__':
100#     unittest.main()100#     unittest.main()
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op

f1#keys for bushesf1#keys for bushes
2bushes_keys = ('храст', 'shrub', 'bush',)2bushes_keys = ('храст', 'shrub', 'bush',)
33
4#check if argument is a valid bush4#check if argument is a valid bush
5def is_bush(arg):5def is_bush(arg):
6    if type(arg) != dict or 'name' not in arg:6    if type(arg) != dict or 'name' not in arg:
7        return False7        return False
88
9    if arg['name'].lower() not in bushes_keys:9    if arg['name'].lower() not in bushes_keys:
10        return False10        return False
1111
12    return True12    return True
1313
14#check if the multitude of bushes is valid14#check if the multitude of bushes is valid
15def is_pretty_bush(price, unique_letters):15def is_pretty_bush(price, unique_letters):
16    if int(price) == 0:16    if int(price) == 0:
17        return False17        return False
18    18    
19    return len(unique_letters) % int(price) == 0 and price <= 42.0019    return len(unique_letters) % int(price) == 0 and price <= 42.00
2020
21def function_that_says_ni(*args, **kwargs):21def function_that_says_ni(*args, **kwargs):
22    22    
23    price = 0.0023    price = 0.00
2424
25    #iterate positioned args25    #iterate positioned args
26    for positioned in args:26    for positioned in args:
27        if is_bush(positioned):27        if is_bush(positioned):
28            if 'cost' in positioned:28            if 'cost' in positioned:
29                price += positioned['cost']29                price += positioned['cost']
30    30    
31    #iterate named args31    #iterate named args
32    for named in kwargs.values():32    for named in kwargs.values():
n33            if is_bush(named):n33        if is_bush(named):
34                if 'cost' in named:34            if 'cost' in named:
35                    price += named['cost']35                price += named['cost']
3636
37    #get unique characters found in the bushes in the multitude37    #get unique characters found in the bushes in the multitude
38    unique_letters = set(''.join([key for key, value in kwargs.items() if is_bush(value)]))38    unique_letters = set(''.join([key for key, value in kwargs.items() if is_bush(value)]))
3939
40    if is_pretty_bush(price, unique_letters):40    if is_pretty_bush(price, unique_letters):
41        return f'{price:.2f}лв.'41        return f'{price:.2f}лв.'
42    return 'Ni!'42    return 'Ni!'
t43 t
4443
45# import unittest44# import unittest
46# from function_that_says_ni import function_that_says_ni 45# from function_that_says_ni import function_that_says_ni 
4746
48# class TestFunctionThatSaysNi(unittest.TestCase):47# class TestFunctionThatSaysNi(unittest.TestCase):
49    48    
50#     def test_valid_bushes_with_cost(self):49#     def test_valid_bushes_with_cost(self):
51#         self.assertEqual(function_that_says_ni({"name": "храст", "cost": 1.50}, {"name": "sHRub", "cost": 3.00}), "4.50лв.")50#         self.assertEqual(function_that_says_ni({"name": "храст", "cost": 1.50}, {"name": "sHRub", "cost": 3.00}), "4.50лв.")
52#         self.assertEqual(function_that_says_ni({"name": "хРАст", "cost": 150}, {"name": "shrub", "cost": 3.00}), "Ni!")51#         self.assertEqual(function_that_says_ni({"name": "хРАст", "cost": 150}, {"name": "shrub", "cost": 3.00}), "Ni!")
5352
54#     def test_invalid_bushes(self):53#     def test_invalid_bushes(self):
55#         self.assertEqual(function_that_says_ni({"ddd": "храст", "cost": 1.50}, {"namae": "sHRub", "cost": 3.00}), "Ni!")54#         self.assertEqual(function_that_says_ni({"ddd": "храст", "cost": 1.50}, {"namae": "sHRub", "cost": 3.00}), "Ni!")
56#         self.assertEqual(function_that_says_ni({"namdde": "хРАст", "cost": 150}, {"namse": "shrub", "cost": 3.00}), "Ni!")55#         self.assertEqual(function_that_says_ni({"namdde": "хРАст", "cost": 150}, {"namse": "shrub", "cost": 3.00}), "Ni!")
5756
58#     def test_invalid_bushes_with_cost(self):57#     def test_invalid_bushes_with_cost(self):
59#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 244.00}), "Ni!")58#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 244.00}), "Ni!")
60#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храстченце", "cost": 2.00}), "Ni!")59#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храстченце", "cost": 2.00}), "Ni!")
61#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 41.99}), "41.99лв.")60#         self.assertEqual(function_that_says_ni({"name": "буш", "cost": 1.00}, {"name": "храст", "cost": 41.99}), "41.99лв.")
6261
63#     def test_valid_bushes_without_cost(self):62#     def test_valid_bushes_without_cost(self):
64#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "buSh"}), "Ni!")63#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "buSh"}), "Ni!")
65#         self.assertEqual(function_that_says_ni(a={"name": "храст"}, b={"name": "shrub"}), "Ni!")64#         self.assertEqual(function_that_says_ni(a={"name": "храст"}, b={"name": "shrub"}), "Ni!")
6665
67#     def test_invalid_bushes_without_cost(self):66#     def test_invalid_bushes_without_cost(self):
68#         self.assertEqual(function_that_says_ni({"name": "храст44"}, {"name": "bus44h"}), "Ni!")67#         self.assertEqual(function_that_says_ni({"name": "храст44"}, {"name": "bus44h"}), "Ni!")
69#         self.assertEqual(function_that_says_ni(a={"name": "храс124т"}, b={"name": "s52hrub"}), "Ni!")68#         self.assertEqual(function_that_says_ni(a={"name": "храс124т"}, b={"name": "s52hrub"}), "Ni!")
7069
71#     def test_valid_bushes_with_and_without_cost(self):70#     def test_valid_bushes_with_and_without_cost(self):
72#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "bush", "cost": 33.33}), "33.33лв.")71#         self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "bush", "cost": 33.33}), "33.33лв.")
73#         self.assertEqual(function_that_says_ni(a={"name": "храст", "cost": 17}, b={"name": "shrub"}), "Ni!")72#         self.assertEqual(function_that_says_ni(a={"name": "храст", "cost": 17}, b={"name": "shrub"}), "Ni!")
7473
75#     def test_not_pretty_bushes_due_to_price(self):74#     def test_not_pretty_bushes_due_to_price(self):
76#         self.assertEqual(function_that_says_ni({"name": "храсТ", "cost": 50.0}), "Ni!")75#         self.assertEqual(function_that_says_ni({"name": "храсТ", "cost": 50.0}), "Ni!")
77#         self.assertEqual(function_that_says_ni({"name": "shrub", "cost": 43.00}), "Ni!")76#         self.assertEqual(function_that_says_ni({"name": "shrub", "cost": 43.00}), "Ni!")
7877
79#     def test_not_pretty_bushes_due_to_unique_letters(self):78#     def test_not_pretty_bushes_due_to_unique_letters(self):
80#         self.assertEqual(function_that_says_ni(ad={"name": "храст", "cost": 1.80}, b={"name": "храст", "cost": 1}), "Ni!")79#         self.assertEqual(function_that_says_ni(ad={"name": "храст", "cost": 1.80}, b={"name": "храст", "cost": 1}), "Ni!")
81#         self.assertEqual(function_that_says_ni(a={"name": "буш"}, b={"name": "шрасх"}), "Ni!")80#         self.assertEqual(function_that_says_ni(a={"name": "буш"}, b={"name": "шрасх"}), "Ni!")
8281
83#     def test_mixed_types(self):82#     def test_mixed_types(self):
84#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 0.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "1.80лв.")83#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 0.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "1.80лв.")
85#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 30.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")84#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 30.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")
86#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")  85#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}), "Ni!")  
87#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}, da=(1,2)), "Ni!")  86#        self.assertEqual(function_that_says_ni(4, 4, {"name": "храст", "cost": 40.0}, [3,4,5], ad={"name": "храст", "cost": 1.80}, da=(1,2)), "Ni!")  
88#        self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "храст", "cost": 0.0}, ["ffffffffff", {1, 2, 3}]), "Ni!") 87#        self.assertEqual(function_that_says_ni({"name": "храст"}, {"name": "храст", "cost": 0.0}, ["ffffffffff", {1, 2, 3}]), "Ni!") 
89    88    
90#     def test_all_in_one_first_variation(self):89#     def test_all_in_one_first_variation(self):
91#        self.assertEqual(function_that_says_ni(4, 4, {"name": "ХРраст", "cost": 10.0}, [3,4,5], ad={"name": "хРаст", "cost": 1.80}, da = "pypy"), "1.80лв.")90#        self.assertEqual(function_that_says_ni(4, 4, {"name": "ХРраст", "cost": 10.0}, [3,4,5], ad={"name": "хРаст", "cost": 1.80}, da = "pypy"), "1.80лв.")
92#        self.assertEqual(function_that_says_ni(4, 4, {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")91#        self.assertEqual(function_that_says_ni(4, 4, {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")
93#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")92#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 100.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "Ni!")
9493
95#     def test_all_in_one_second_variation(self):94#     def test_all_in_one_second_variation(self):
96#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "11.00лв.")95#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "11.00лв.")
97#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "bush", "cost": 1.80}, c = "pypy"), "Ni!")96#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 11.0}, ad={"name": "bush", "cost": 1.80}, c = "pypy"), "Ni!")
98#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 12.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "12.00лв.")97#        self.assertEqual(function_that_says_ni( {"name": "Храст", "cost": 12.0}, ad={"name": "дърво", "cost": 1.80}, c = "pypy"), "12.00лв.")
99        98        
100# if __name__ == '__main__':99# if __name__ == '__main__':
101#     unittest.main()100#     unittest.main()
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op