Beispiel #1
0
def main():
    arr = create_arr(sys.argv[1])  #from parse_money_tracker
    my_dict = process_dict(arr)
    print(my_dict)
    a = AggregatedObject(my_dict)
    a.process()
    #print(a.all_user_data)
    mt_menu = MoneyTrackerMenu(a)
    mt_menu.option()
def main():
    while(True):
        file_name = input()
        try:
            parser = MoneyDataParser(file_name)
            data = parser.parse_data()
            print(data)
            aggregator = AggregateData(data)
            tracker = MoneyTracker(aggregator)
            menu = MoneyTrackerMenu(tracker)
            menu.start_menu()
            break
        except FileNotFoundError:
            print("This file doesnt exist!Please try again.")
Beispiel #3
0
def main():
    username = sys.argv[1].lower()
    filename = "money_tracker_{}.txt".format(username)
    parsed_data = ParseData(filename)
    aggregated_object = AggregatedMoneyTracker(parsed_data)
    money_tracker = MoneyTracker(aggregated_object)
    menu = MoneyTrackerMenu(username, money_tracker)
 def test_date_parser_invalid_dates(self):
     with self.assertRaises(ValueError):
         MoneyTrackerMenu.date_parser('15.12.2018')
     with self.assertRaises(ValueError):
         MoneyTrackerMenu.date_parser('12,12,208')
     with self.assertRaises(ValueError):
         MoneyTrackerMenu.date_parser('abc')
     with self.assertRaises(ValueError):
         MoneyTrackerMenu.date_parser('2018,12,12')
Beispiel #5
0
def main():
    menu = MoneyTrackerMenu()
    menu.start()
 def test_amount_parser_valid_arguments(self):
     self.assertEqual(MoneyTrackerMenu.amount_parser('123'), 123)
     self.assertEqual(MoneyTrackerMenu.amount_parser('15.5'), 15.5)
 def test_amount_parser_non_number_argument(self):
     with self.assertRaises(ValueError):
         MoneyTrackerMenu.amount_parser('2018,12,12')
     with self.assertRaises(ValueError):
         MoneyTrackerMenu.amount_parser('abc')
 def test_date_parser_valid_dates(self):
     self.assertEqual(MoneyTrackerMenu.date_parser('12,12,2018'),
                      (12, 12, 2018))
     self.assertEqual(MoneyTrackerMenu.date_parser('5,1,2018'),
                      (5, 1, 2018))