Created
February 21, 2022 17:12
-
-
Save timurbakibayev/23e745fb15a7e65de7fe709c4566f6d3 to your computer and use it in GitHub Desktop.
new tests
This file contains 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), | |
) | |
new_account = account.add_amount(Decimal(5)) | |
assert new_account.available_amount == 15 | |
assert account.available_amount == 10 | |
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 | |
new_account = account.block_amount(Decimal(7)) | |
assert new_account.available_amount == 3 | |
assert account.available_amount == 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment