1st: I want to write a function "div" that takes two numbers as parameters and returns the quotient of the first number divided by the second number. and need to use a try-except statement to do the division. And in case of division by 0, use the except clause to return a special float value 'nan' (not a number).
2nd: After that, I need to design a number of test cases to test the function (unit test) with the aim of identifying all possible errors of the function. For each test, specify both the input and the expected output. For each test case, carry out the test and compare the actual test result with the expected result..
I'm did 1st point-
def div(a, b):
try:
return a / b
except ZeroDivisionError:
return float('nan')
I'm stuck on the 2nd point called "unit testing"
Can someone please help me?