Не могу понять как сделать второй вывод в коде а именно вывести строковое значение и значения словаря

Задание: Create a decorator function time_decorator which has to calculate decorated function execution time and put this time value to execution_time dictionary where key is decorated function name and value is this function execution time. For example: введите сюда код `@time_decorator def func_add(a, b): sleep(0.2) return a + b

func_add(10, 20) 30 execution_time['func_add'] 0.212341254` мой код

import time

def time_decorator (func):
    def inner(*args, **kwargs):
        start = time.time()
        ret = func(*args, **kwargs)
        end = time.time()
        execution_time = {func.__name__: end-start}
        print(execution_time)
        return ret
    return inner

@time_decorator
def func_add(a, b):
    time.sleep(0.2)
    return print(a + b)

func_add(10, 20)

вывод `>>> 30

{'func_add': 0.20314431190490723}`

Тест проверка не проходит

import time
from ..main import time_decorator, execution_time

TIME_100MS = 0.1


@time_decorator
def func_test1(a, b, sleep_time):
    time.sleep(sleep_time)
    return a + b


def test_f1_time_decorator():
    sleep_time = TIME_100MS
    assert 30 == func_test1(10, 20, sleep_time)
    assert execution_time[func_test1.__name__] > sleep_time

Ответы (0 шт):