File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,31 @@ class BankAccount:
1919 130.0
2020 >>> account.account_number
2121 'ACC-1001'
22+
23+ >>> BankAccount("", initial_balance=10.0)
24+ Traceback (most recent call last):
25+ ...
26+ ValueError: account_number must be provided
27+
28+ >>> BankAccount("ACC-1002", initial_balance=-1.0)
29+ Traceback (most recent call last):
30+ ...
31+ ValueError: initial_balance cannot be negative
32+
33+ >>> account.deposit(0)
34+ Traceback (most recent call last):
35+ ...
36+ ValueError: deposit amount must be positive
37+
38+ >>> account.withdraw(0)
39+ Traceback (most recent call last):
40+ ...
41+ ValueError: withdraw amount must be positive
42+
43+ >>> account.withdraw(1000)
44+ Traceback (most recent call last):
45+ ...
46+ ValueError: insufficient funds
2247 """
2348
2449 def __init__ (self , account_number : str , initial_balance : float = 0.0 ) -> None :
You can’t perform that action at this time.
0 commit comments