Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write 2 unit tests for the 3 functions below ( add _ by _ kind, add _ by _ date and lookup _ by _
Write unit tests for the functions below addbykind, addbydate and lookupbykindanddate Remember that a unit test function name starts with test The 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 addbykindgardendict, kind, plant: if kind in gardendict: gardendictkindappendplant else: gardendictkindplant def addbydategardendict, date, plant: if date in gardendict: gardendictdateappendplant else: gardendictdateplant def lookupbykindanddatekinddict, datedict, kind, date: plantstoplant if kind in kinddict and date in datedict: for plant in kinddictkind: if plant in datedictdate: plantstoplant.appendplant return plantstoplant
Write unit tests for the functions below addbykind, addbydate and lookupbykindanddate Remember that a unit test function name starts with test
The 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 addbykindgardendict, kind, plant:
if kind in gardendict:
gardendictkindappendplant
else:
gardendictkindplant
def addbydategardendict, date, plant:
if date in gardendict:
gardendictdateappendplant
else:
gardendictdateplant
def lookupbykindanddatekinddict, datedict, kind, date:
plantstoplant
if kind in kinddict and date in datedict:
for plant in kinddictkind:
if plant in datedictdate:
plantstoplant.appendplant
return plantstoplant
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started