For example, you may have a function:
group_by_age() -> Dict[int, List[str]]
group_by_age() -> Dict[Age, List[CustomerId]]
Your test assertions may also become easier to read:
assert group_by_age() == { Age(23): [ CustomerId("0471"), CustomerId("3390"), ], Age(42): [ CustomerId("2334"), ], }
For example, you may have a function:
which might be perfectly good for your use case, but I can see why one might instead prefer: for self-documentation and expressiveness.Your test assertions may also become easier to read: