I have written code but would not understand how to write test cases in python for below program. Can someone provide an example test case?
Thanks in advance. I have tried some samples but I do not understand what parts of the code should be tested as it only pick the company name related with highest price.
with open('/home/company_data.csv') as f:
reader = csv.reader(f)
tup = namedtuple('tup', ['price','year', 'month'])
d = OrderedDict()
names = next(reader)[2:]
for name in names:
d[name] = tup(0,'year', 'month')
for row in reader:
year, month = row[:2]
for name, price in zip(names, map(int, row[2:])):
if d[name].price < price:
d[name] = tup(price, year, month)
Aucun commentaire:
Enregistrer un commentaire