Question: Write 2 unit tests for the 3 functions below ( add _ by _ kind, add _ by _ date and lookup _ by _

Write 2 unit tests for the 3 functions below (add_by_kind, add_by_date and lookup_by_kind_and_date). Remember that a unit test function name starts with test_.
The 2 unit tests should consist of:
-One edge case
-One use case
Include descriptive function names and docstrings, so that it captures what is being tested.
def add_by_kind(garden_dict, kind, plant):
if kind in garden_dict:
garden_dict[kind].append(plant)
else:
garden_dict[kind]=[plant]
def add_by_date(garden_dict, date, plant):
if date in garden_dict:
garden_dict[date].append(plant)
else:
garden_dict[date]=[plant]
def lookup_by_kind_and_date(kind_dict, date_dict, kind, date):
plants_to_plant =[]
if kind in kind_dict and date in date_dict:
for plant in kind_dict[kind]:
if plant in date_dict[date]:
plants_to_plant.append(plant)
return plants_to_plant

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!