def add_lists(json_dict, num, bal, d=date.today()): """ adds 'num' number of lists having a grand total equal to bal """ list_bal = float(bal) / num for i in range(1, num + 1): nd = inc_date(d, i) json_dict[main.timestamp(nd)] = create_list(list_bal) return json_dict
def add_update_subparser(subparsers): """ Subparser for the update command """ parser_update = subparsers.add_parser('update') help = "Name of the sheet in which update takes place." parser_update.add_argument('sheet', type=str, help=help) help = "amount to be added.(+/- number)." parser_update.add_argument('amount', type=str, help=help) help = "Change the date. Defaults to current date." parser_update.add_argument('--date', default=main.timestamp(), help=help)
def add_update_subparser(subparsers): """ Subparser for the update command """ parser_update = subparsers.add_parser("update") help = "Name of the sheet in which update takes place." parser_update.add_argument("sheet", type=str, help=help) help = "amount to be added.(+/- number)." parser_update.add_argument("amount", type=str, help=help) help = "Change the date. Defaults to current date." parser_update.add_argument("--date", default=main.timestamp(), help=help)
def fakeDict(num=100, bal=100): json_dict = {main.INIT: main.timestamp()} if num > 0: add_lists(json_dict, num, bal) return json_dict
def test_update(self): d = main.timestamp(date.today() + timedelta(days=1)) self.fakeDict[d] = [str(self.bal)] main.update(td.fakeSheet, d, self.bal) self.assertEqual(main.readSheet(td.fakeSheet), self.fakeDict)