Write a Python class for [purpose, e.g. a shopping cart]. Include type hints, docstrings, validation, a clean public API, and pytest unit tests covering normal use and edge cases.
Write a Python class with tests
A well-designed Python class with type hints and unit tests.