Skip to content
Snippets Groups Projects
Commit bafbb894 authored by joberembt's avatar joberembt
Browse files

Upload New File

parent 0b62fb74
No related branches found
No related tags found
No related merge requests found
import pytest # pytest module importing
from account import account # importing class account from account.py in the same directory
def test_init():
# test for init method
acc1 = account("Bob") # object creation
assert acc1.getname() == "Bob" # checking name
assert acc1.getbalance() == 0 # checking balance
def test_deposit():
# test for deposit method
acc1 = account("Bob") # object creation
acc1.deposit(20)
assert acc1.getbalance() == 20 # checking balance
def test_withdraw():
# test for withdraw method
acc1 = account("Bob") # object creation
acc1.deposit(100)
acc1.withdraw(20)
assert acc1.getbalance() == 80 # checking balance
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment