Examples of unittests used in my small programme
Hey, I have tough time working on this. I need to add 3 unittest's to my code, nothing too complicated, just need to use unittest and check something in this code, like is it possible to count NPV (so it's checking if there are 9 values in my .csv file? not sure how does testing work...) ? I have no idea how to implement it to my code and I can't understand examples from the internet. Would love to see them on my code, maybe then I could finally get it. Can anyone of you help me with this? My code is counting NPV from .csv file (here's a link to it: https://www.justbeamit.com/w8iuk) Code: --- from pandas import read_csv from numpy import npv def counting_npv(): for index, row in fund.iterrows(): row = row.tolist() np_list.append(npv(row[1], row[2:])) prjN = row[0] print("NPV for project no. {}: PLN {:,.2f}".format(prjN, np_list[index])) fund = read_csv("inwestycje.csv", delimiter=',') funds = [tuple(x) for x in fund.values] np_list = [] counting_npv() maxnpv = (np_list.index(max(np_list)))+1 print ("Best project: {}.".format(maxnpv)) --- Thank you in advance! Cheers.