Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

ISBN: ? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago