build: renamed directory from test_tutorial to tests_tutorial for pytest
This commit is contained in:
1 parent
c577565301
commit
69ac65795a
4 files changed
No files matched your search
@@ -0,0 +1,21 @@
|
||||
from src.tutorial.testing.shop.pricing import discount_price
|
||||
import pytest
|
||||
|
||||
|
||||
def test_discount_price_reduces_price():
|
||||
result = discount_price(100.0, 20.0)
|
||||
assert result == 80
|
||||
|
||||
assert discount_price(100.0, 50.0) == 50
|
||||
assert discount_price(100.0, 0) == 100
|
||||
assert discount_price(100.0, 100) == 0
|
||||
|
||||
|
||||
def test_negative_orice_raises_value_error() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
discount_price(-100.0, 50.0) is ValueError
|
||||
|
||||
|
||||
def test_percent_above_hundered_message() -> None:
|
||||
with pytest.raises(ValueError, match="between 0 and 100"):
|
||||
discount_price(100.0, 150.0)
|
||||
Reference in new issue
Block a user