Write tests
- Create the test file named
<module>_test.py next to the module.
- Use this shape:
import unittest
from parcel_calc import total
ITEMS = [10, 20]
class TotalTest(unittest.TestCase):
def test_total(self):
self.assertEqual(total(ITEMS), 30)
def test_total_empty(self):
self.assertEqual(total([]), 0)
if __name__ == "__main__":
unittest.main()
- Run
python <module>_test.py and confirm that both tests pass.
Use this skill with your AI agent:
Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.