def test_unfunded_logs_success(self, machine: VendingMachine, caplog):
        """
        Tests to make sure that the success message still displays, even
        with 0 balance
        """

        machine.dispense_change()
        self.logs_one_message(caplog)
        assert "SUCCESS" in caplog.text
        assert "Dispensed" in caplog.text
 def test_funded_logs_success_with_funded_amount(
         self, loaded_machine: VendingMachine, caplog):
     """
     Tests to make sure that the success message has the balance in it
     """
     balance = loaded_machine.balance
     loaded_machine.dispense_change()
     self.logs_one_message(caplog)
     assert str(balance) in caplog.text
     assert "SUCCESS" in caplog.text
     assert "Dispensed" in caplog.text
    def test_resets_balance(self, machine: VendingMachine, deposit: Decimal):
        """
        Test case to ensure that no leftover balance
        is retained after someone requests their change,
        regardless of size of previous deposits
        """

        machine.deposit(deposit)
        machine.deposit(deposit)

        change = machine.dispense_change()
        assert change == money.add(deposit, deposit)
        assert machine.balance == Decimal(0)