Practice ยท 1 of 1
InMemoryOrderRepository
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.
Difficulty: advanced
Press Submit to check your solution.
Back to lesson: Practice: Repository Practice