def test_example(self): basket = FranciaBasket() receipt = Receipt() [basket.add_item(value) for value in self.value_input] basket.print_receipt(receipt) out = receipt.deliver().split('\n') i = 0 for value in self.value_output: self.assertEqual(value, out[i]) i += 1
class TestReceiptFormatCase(unittest.TestCase): def setUp(self): self.receipt = Receipt() def test_print_empty_receipt(self): self.assertEqual("\nSales Taxes: 0.00\nTotal: 0.00", self.receipt.deliver()) def test_print_two_orders_receipt(self): orders = [ Order('1 book at 10.00'), Order('1 book at 10.00') ] self.receipt.set_orders(orders) self.receipt.set_tax(Decimal(2.53)) self.receipt.set_total(Decimal(11.78)) self.assertEqual( "1 book: 10.00\n1 book: 10.00\nSales Taxes: 2.53\nTotal: 11.78", self.receipt.deliver())
def setUp(self): self.receipt = Receipt()