On 19/12/2015 23:19, malitic...@gmail.com wrote:
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


It's a start but you've still left things out. If I run your code as given above it outputs "invalid transaction", exactly as expected. So how are you running the code? Where does the extra output you give above come from, presumably the "test case", whatever that might be?

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to