Skip to content

Instantly share code, notes, and snippets.

@timurbakibayev
Created February 20, 2022 20:30
Show Gist options
  • Save timurbakibayev/afb126f73e8d2d3b5a537b2b12e53133 to your computer and use it in GitHub Desktop.
Save timurbakibayev/afb126f73e8d2d3b5a537b2b12e53133 to your computer and use it in GitHub Desktop.
Testing the normal account
import pytest
from decimal import Decimal
from main import Account
class TestNormalAccount:
def test_add_amount(self) -> None:
account = Account(
amount=Decimal(10),
blocked=Decimal(0),
)
account.add_amount(Decimal(5))
assert account.available_amount == 15
def test_block_amount(self) -> None:
account = Account(
amount=Decimal(10),
blocked=Decimal(0),
)
with pytest.raises(ValueError):
account.block_amount(Decimal(11))
assert account.available_amount == 10
account.block_amount(Decimal(7))
assert account.available_amount == 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment