Test suite for computeSubtotal
Run
1import unittest
2from your_module import computeSubtotal # Replace 'your_module' with the real module name
3
4def test_compute_subtotal_empty_list():…
7
8def test_compute_subtotal_positive_values():
9 """Sum of positive prices."""
10 assert computeSubtotal([2, 4, 6, 8, 10]) == 30
11
12def test_compute_subtotal_negative_values():
13 """Sum with refunds applied."""
14 assert computeSubtotal([-3, -5, -7]) == -15
15
16def test_compute_subtotal_mixed_values():…
19
20def test_compute_subtotal_floating_point():…
24
25def test_compute_subtotal_large_basket():
26 """Sum across a very large basket (stress test)."""
27 assert computeSubtotal([1_200_000, 2_400_000, 3_600_000]) == 7_200_000
Console
Run
ModuleNotFoundError: No module named 'your_module'
module:2