Files
startup-product/tests/test_pricing.py
T
sespinal 35605c33b9
startup-product-ci/pipeline/pr-main There was a failure building this commit
Add pricing checks and controlled defect for issue #8
2026-10-21 23:07:42 +00:00

18 lines
470 B
Python

import unittest
from pricing import total_price
class PricingTests(unittest.TestCase):
def test_total(self):
self.assertEqual(total_price(10, 3), 30)
def test_single_item(self):
self.assertEqual(total_price(12.5, 1), 12.5)
def test_invalid_quantity(self):
for quantity in (0, -1):
with self.subTest(quantity=quantity):
with self.assertRaises(ValueError):
total_price(10, quantity)