import unittest
import pytest
from lasagna import (
                    EXPECTED_BAKE_TIME,
                    bake_time_remaining,
                    preparation_time_in_minutes,
                    elapsed_time_in_minutes
                    )


class LasagnaTest(unittest.TestCase):

    @pytest.mark.task(taskno=1)
    def test_EXPECTED_BAKE_TIME(self):
        self.assertEqual(EXPECTED_BAKE_TIME, 40,
                         msg="Expected a constant of EXPECTED_BAKE_TIME with a value of 40.")

    @pytest.mark.task(taskno=2)
    def test_bake_time_remaining(self):
        input_data = [1, 2, 5, 10, 15, 23, 33, 39]
        result_data = [40 - item for item in input_data]
        number_of_variants = range(1, len(input_data) + 1)

        for variant, time, result in zip(number_of_variants, input_data, result_data):
            with self.subTest(f"variation #{variant}", time=time, result=result):
                self.assertEqual(bake_time_remaining(time), result,
                                 msg=f'Expected: {result} but the bake time remaining was calculated incorrectly.')

    @pytest.mark.task(taskno=3)
    def test_preparation_time_in_minutes(self):
        input_data = [1, 2, 5, 8, 11, 15]
        result_data = [item * 2 for item in input_data]
        number_of_variants = range(1, len(input_data) + 1)

        for variant, layers, time in zip(number_of_variants, input_data, result_data):
            with self.subTest(f"variation #{variant}", layers=layers, time=time):
                self.assertEqual(preparation_time_in_minutes(layers), time,
                                 msg=f'Expected: {time} minutes, but preparation time'
                                     f' was calculated incorrectly.')

    @pytest.mark.task(taskno=4)
    def test_elapsed_time_in_minutes(self):
        layer_data = (1, 2, 5, 8, 11, 15)
        time_data = (3, 7, 8, 4, 15, 20)
        result_data = [prep * 2 + elapsed for prep, elapsed in zip(layer_data, time_data)]
        number_of_variants = range(1, len(time_data) + 1)

        for variant, layers, time, total_time in zip(number_of_variants, layer_data, time_data, result_data):
            with self.subTest(f"variation #{variant}", layers=layers, time=time, total_time=total_time):
                failure_msg = f'Expected {time} minutes elapsed, but the timing was calculated incorrectly.'
                self.assertEqual(elapsed_time_in_minutes(layers, time), total_time, msg=failure_msg)

    @pytest.mark.task(taskno=5)
    def test_docstrings_were_written(self):
        self.assertIsNotNone(elapsed_time_in_minutes.__doc__,
                             msg="Expected a docstring for elapsed_time_in_minutes, but recieved None instead.")
        self.assertIsNotNone(preparation_time_in_minutes.__doc__,
                             msg="Expected a docstring for preparation_time_in_minutes, but recieved None instead.")
        self.assertIsNotNone(bake_time_remaining.__doc__,
                             msg="Expected a docstring for bake_time_remaining, but no docstring was found.")


if __name__ == "__main__":
    unittest.main()

@@ -2555,327 +2555,383 @@
     
-self.assertIsNotNone(elapsed_time_in_minutes.__doc__,%0A                             msg=%22Expected a docstring for elapsed_time_in_minutes, but recieved None instead.%22)%0A        self.assertIsNotNone(prep
+functions = %5Bbake_time_remaining, preparation_time_in_minutes, elapsed_time_in_minutes%5D%0A        number_of_variants = range(1, len(functions) + 1)%0A%0A        for variant, function in zip(number_of_variants, functions):%0A            with self.subTest(f%22v
 ar
+i
 ation
-_time_in_minutes.__doc__,%0A                             msg=%22Expected a docstring for preparation_time_in_minutes
+ #%7Bvariant%7D%22, function=function):%0A                failure_msg = msg = f'Expected a docstring for %60%7Bfunction.__name__%7D%60
 , bu
@@ -2939,18 +2939,20 @@
  rec
-i
 e
+i
 ved 
+%60
 None
+%60
  ins
@@ -2960,19 +2960,25 @@
 ead.
-%22)%0A
+'%0A       
         
 self
@@ -2965,32 +2965,33 @@
 %0A               
+ 
 self.assertIsNot
@@ -2999,145 +2999,41 @@
 one(
-bake_time_remaining.__doc__,%0A                             msg=%22Expected a docstring for bake_time_remaining, but no docstring was found.%22
+function.__doc__, msg=failure_msg
 )%0A%0A%0A

Fix typo in `guidos-gorgeous-lasagna` tests