Need help on a project To :"Create a class called BankAccount with the following parameters "

malitician at gmail.com malitician at gmail.com
Sat Dec 19 18:19:56 EST 2015


you are absolutely correct Mark 
i'm a beginner in python and  from the original question and test case given above i wrote this 



class BankAccount(object):
    def __init__(self, initial_balance=0):
        self.balance = initial_balance
    def deposit(self, amount):
        self.balance +=amount
    def withdraw(self, amount):
        self.balance -= amount
my_account = BankAccount(90)
my_account.withdraw(1000)
if my_account.balance < 4:
    print('invalid transaction')
class MinimumBalanceAccount(BankAccount):
    def __init__(self, MinimumBalance=4):
        self.minbalance = MinimumBalance





after executing this i got this  TEST SOLUTION ERROR which i don't know what it means





{"finished": true, "success": [{"fullName": "test_balance", "passedSpecNumber": 1}, {"fullName": "test_deposit", "passedSpecNumber": 2}, {"fullName": "test_sub_class", "passedSpecNumber": 3}, {"fullName": "test_withdraw", "passedSpecNumber": 4}], "passed": false, "started": true, "failures": [{"failedSpecNumber": 1, "fullName": "test_invalid_operation", "failedExpectations": [{"message": "Failure in line 23, in test_invalid_operation\n    self.assertEqual(self.my_account.withdraw(1000), \"invalid transaction\", msg='Invalid transaction')\nAssertionError: Invalid transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0, "time": "0.000065"}}
-910
invalid transaction



SO please what is wrong with my code, does it not meet the requirement of the "test case" given above in the question? 
Thanks in advance



More information about the Python-list mailing list