Created
February 20, 2022 20:30
-
-
Save timurbakibayev/afb126f73e8d2d3b5a537b2b12e53133 to your computer and use it in GitHub Desktop.
Testing the normal account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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