3
3
4
4
# Тестирование переключения темной темы на сайте в зависимости от времени
5
5
def test_dark_theme_by_time ():
6
-
7
6
current_time = time (hour = 23 )
8
- is_dark_theme = None
9
-
10
- if 6 < current_time .hour >= 22 :
11
- is_dark_theme = True
7
+ is_dark_theme = 6 < current_time .hour >= 22
12
8
13
9
assert is_dark_theme is True
14
10
15
11
16
12
# Тестирование переключения темной темы на сайте в зависимости от времени и выбора пользователя
17
13
def test_dark_theme_by_time_and_user_choice ():
18
-
19
14
current_time = time (hour = 16 )
20
15
dark_theme_enabled_by_user = True
21
16
is_dark_theme = None
@@ -30,7 +25,6 @@ def test_dark_theme_by_time_and_user_choice():
30
25
31
26
32
27
def test_find_suitable_user ():
33
-
34
28
users = [
35
29
{"name" : "Oleg" , "age" : 32 },
36
30
{"name" : "Sergey" , "age" : 24 },
@@ -64,15 +58,9 @@ def test_find_suitable_user():
64
58
65
59
# Функция, которая будет печатать читаемое имя переданной ей функции и значений аргументов.
66
60
def print_func_names (func , * args ):
67
- func_name = func .__name__
68
- arguments = list (args )
69
-
70
- words = func_name .replace ("_" , " " ).split () # open_browser -> ["open", "browser"]
71
- capitalized_words = [word .capitalize () for word in words ] # ["open", "browser"] -> ["Open", "Browser"]
72
- result = ' ' .join (capitalized_words ) # "Open Browser"
73
-
74
- args_result = ', ' .join (arguments ) # ["https://companyname.com/login", "Register"] -> "https://companyname.com/login, Register"
75
- result = f"{ result } [{ args_result } ]"
61
+ func_name = func .__name__ .replace ("_" , " " ).title () # open_browser => "open browser" => "Open Browser"
62
+ args_result = ", " .join ([* args ]) # ["https://companyname.com/login", "Register"] => "https://companyname.com/login, Register"
63
+ result = f"{ func_name } [{ args_result } ]"
76
64
77
65
print (result )
78
66
return result
0 commit comments