Question: 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
