def test_summate_empty_list(self): total = cursor_parser.summate_purchases([]) self.assertEqual(total, 0)
def test_summate_multiple_purchases(self): purchases = mock.multiple_purchases() total = cursor_parser.summate_purchases(purchases) self.assertEqual(total, 35.0)
def handle_get_total_request(self): user_name = self.get_current_user_name() purchases = self.store.get_recent_purchases_by_name(user_name) total = cursor_parser.summate_purchases(purchases) self.send_message('So far this month you\'ve spent: ' + str(total))
def test_summate_single_purchase(self): purchase = mock.single_purchase_in_list() total = cursor_parser.summate_purchases(purchase) self.assertEqual(total, 10.0)
def get_last_months_totals(): bens_purchases = get_last_months_purchases_by_name('Ben') katies_purchases = get_last_months_purchases_by_name('Katie') bens_total = cursor_parser.summate_purchases(bens_purchases) katies_total = cursor_parser.summate_purchases(katies_purchases) return [('Ben', bens_total), ('Katie', katies_total)]