testing the class in code fragment we demonstrate some basic usage of the creditcard classinserting three cards into list named wallet we use loops to make some charges and paymentsand use various accessors to print results to the console these tests are enclosed within conditionalif name =__main__ :so that they can be embedded in the source code with the class definition using the terminology of section these tests provide method coverageas each of the methods is called at least oncebut it does not provide statement coverageas there is never case in which charge is rejected due to the credit limit this is not particular advanced from of testing as the output of the given tests must be manually audited in order to determine whether the class behaved as expected python has tools for more formal testing (see discussion of the unittest module in section )so that resulting values can be automatically compared to the predicted outcomeswith output generated only when an error is detected if name =__main__ wallet wallet append(creditcardjohn bowman california savings wallet append(creditcardjohn bowman california federal wallet append(creditcardjohn bowman california finance for val in range( ) wallet[ charge(val wallet[ charge( val wallet[ charge( val for in range( ) printcustomer wallet[cget customer) printbank wallet[cget bank) printaccount wallet[cget account) printlimit wallet[cget limit) printbalance wallet[cget balance) while wallet[cget balance wallet[cmake payment( printnew balance wallet[cget balance) printcode fragment testing the creditcard class