# I have this problem with the docstrings of the lasagna test

I have the following problem, these are my docstring, but I still can’t run the last test

“”"Calculate the elapsed time.

``````Keyword arguments:
:param number_of_layers: int the number of layers in the lasagna
:param elapsed_bake_time: int elapsed cooking time
:return:  int total time elapsed (in in minutes) preparing and cooking

This function takes two integers representing the number of lasagna
layers and the time already spent baking
and calculates the total elapsed minutes spent cooking the lasagna.

notes:
- The function assumes that the preparation time per layer is constant and does not vary.
- The elapsed cooking time must be given in minutes.
- The function does not validate if the number of layers or the cooking time is negative.
"""
``````

Can you copy paste your entire solution into a codeblock, as well as the exact test output/failure?

i have problems on the first task1 of lasagna project , even i define constant variable , the checker not validate task

Can you copy paste your entire solution into a codeblock, as well as the exact test output/failure?

Code:
“”"Functions used in preparing Guido’s gorgeous lasagna.

Learn about Guido, the creator of the Python language:

This is a module docstring, used to describe the functionality
of a module and its functions and/or classes.
“”"

#TODO: define the ‘EXPECTED_BAKE_TIME’ constant.
EXPECTED_BAKE_TIME = 40

#TODO: Remove ‘pass’ and complete the ‘bake_time_remaining()’ function below.
def bake_time_remaining(elapsed_bake_time):
“”"Calculate the bake time remaining.

``````:param elapsed_bake_time: int - baking time already elapsed.
:return: int - remaining bake time (in minutes) derived from 'EXPECTED_BAKE_TIME'.

Function that takes the actual minutes the lasagna has been in the oven as
an argument and returns how many minutes the lasagna still needs to bake
based on the `EXPECTED_BAKE_TIME`.
"""

return EXPECTED_BAKE_TIME - elapsed_bake_time
``````

#TODO: Define the ‘preparation_time_in_minutes()’ function below.

# You might also consider using ‘PREPARATION_TIME’ here, if you have it defined.

def preparation_time_in_minutes(number_of_layers):
PREPARATION_TIME = 2
return number_of_layers * PREPARATION_TIME

#TODO: define the ‘elapsed_time_in_minutes()’ function below.

# Remember to add a docstring (you can copy and then alter the one from bake_time_remaining

def elapsed_time_in_minutes(number_of_layers, elapsed_bake_time):
“”"Calculate the elapsed time.

``````Keyword arguments:
:param number_of_layers: int the number of layers in the lasagna
:param elapsed_bake_time: int elapsed cooking time
:return:  int total time elapsed (in in minutes) preparing and cooking

This function takes two integers representing the number of lasagna
layers and the time already spent baking
and calculates the total elapsed minutes spent cooking the lasagna.

notes:
- The function assumes that the preparation time per layer is constant and does not vary.
- The elapsed cooking time must be given in minutes.
- The function does not validate if the number of layers or the cooking time is negative.
"""
return preparation_time_in_minutes(number_of_layers) + elapsed_bake_time
``````

output failure 1

``````"""Validate function.__doc__ exists for each function.
Check the attribute dictionary of each listed function
for the presence of a __doc__ key.

:return: unexpectedly None error when __doc__ key is missing.
"""
functions = [bake_time_remaining, preparation_time_in_minutes, elapsed_time_in_minutes]

for variant, function in enumerate(functions, start=1):
with self.subTest(f'variation #{variant}', function=function):
actual_result = function.__doc__
failure_msg = (f'Called {function.__name__}.__doc__. {actual_result} was returned, '
f'but the tests expected a docstring for the {function.__name__} function.')

# Check that the __doc__ key is populated for the function.
self.assertIsNotNone(actual_result, msg=failure_msg)
``````

### TEST FAILURE

One or more variations of this test failed. Details can be found under each [variant#].

Output failure 2

### CODE RUN

``````"""Validate function.__doc__ exists for each function.
Check the attribute dictionary of each listed function
for the presence of a __doc__ key.

:return: unexpectedly None error when __doc__ key is missing.
"""
functions = [bake_time_remaining, preparation_time_in_minutes, elapsed_time_in_minutes]

for variant, function in enumerate(functions, start=1):
with self.subTest(f'variation #{variant}', function=function):
actual_result = function.__doc__
failure_msg = (f'Called {function.__name__}.__doc__. {actual_result} was returned, '
f'but the tests expected a docstring for the {function.__name__} function.')

# Check that the __doc__ key is populated for the function.
self.assertIsNotNone(actual_result, msg=failure_msg)
``````

### TEST FAILURE

AssertionError: unexpectedly None : Called preparation_time_in_minutes.doc. None was returned, but the tests expected a docstring for the preparation_time_in_minutes function.

You might want to use codeblocks to wrap your code and test output. That makes the code readable.

1. Do you understand what the test is doing?
2. Do you understand what the test is expecting and why?
3. Do you understand what your code returns and how it differs?
4. Do you understand why your code is returning what it returns?

solved thanks