Skip to main content

test: cover normal behavior and edge cases

GBB Demo authored on Nov 2, 2026

parent b2393bccommit 739a3515d5b7

1 file changed, +14 −0

  • test_app.py+14 −0
    @@ -1,0 +1,14 @@
    1+import unittest
    2+import app
    3+
    4+class ApplicationTests(unittest.TestCase):
    5+ def test_total(self):
    6+ self.assertEqual(app.invoice_total([]), 0)
    7+ self.assertEqual(app.invoice_total([{"unit_cents": 500, "quantity": 3}], 10), 1350)
    8+ self.assertEqual(app.invoice_total([{"unit_cents": 101, "quantity": 1}], 50), 51)
    9+ with self.assertRaises(ValueError):
    10+ app.invoice_total([{"unit_cents": -1, "quantity": 1}])
    11+
    12+
    13+if __name__ == "__main__":
    14+ unittest.main()