Practice · 1 of 1
InMemoryOrderRepository
CHALLENGE
Difficulty: advanced+25 XP
Implement InMemoryOrderRepository:
- nested exception OrderNotFound
- save(order) stores a COPY of the order dict (keyed by order['id'])
- get(order_id) returns a COPY; unknown id raises OrderNotFound
- all() returns a list of copies
Graded probe: mutating the dict you received from get() must NOT change repository state — storage leaks through shared references are the classic repository bug.
Press Submit to check your solution.
Back to lesson: Practice: Repository Practice