def test_billbatch_total_calculates_total_amount_of_bills_in_batch(self): bills = [Bill(5), Bill(3), Bill(2)] test = BillBatch(bills) self.assertIsNotNone(test.total()) self.assertEqual(test.total(), 10)
def test_total(self): values = [10, 20, 50, 100] bills = [Bill(value) for value in values] batch = BillBatch(bills) total = batch.total() expexted = 180 self.assertEqual(total, expexted)
def test_if_totall_batch_is_working(self): ls = [10,20,50,100] bills = [Bill(value) for value in ls] exp = 180 batch = BillBatch(bills) res = batch.total() self.assertEqual(res,exp)
from cashdesk import Bill, BillBatch values = [10, 20, 50, 100] bills = [Bill(value) for value in values] batch = BillBatch(bills) for bill in batch: print(bill) print(batch.total()) # A 10$ bill # A 20$ bill # A 50$ bill # A 100$ bill
def test_can_create_billbatch_with_bills(self): bills = [Bill(value) for value in range(1, 10)] batch = BillBatch(bills) self.assertEqual(len(batch), len(range(1, 10))) self.assertEqual(batch.total(), sum(range(10)))
def test_when_total_then_return_sum_of_amounts_of_all_bills_in_billbatch( self): test_billbatch = BillBatch([Bill(10), Bill(20)]) expected_result = 30 self.assertEqual(test_billbatch.total(), expected_result)