Python for production-style code
The small kit that makes fifty minutes of typing read like code you would commit, each piece on a listing the build runs, each next to the mistake it prevents.
Is a frozen dataclass worth the extra lines in a fifty-minute round?
Yes, and it usually saves lines rather than costing them. One decorator gives you equality, hashing, a readable repr and a constructor, so the value can be a dict key, can go in a set, and prints as itself when a test fails. Writing those four methods by hand is twenty lines nobody has time for, and skipping them means every comparison in your code is positional. The version to type is the one line: @dataclass(frozen=True).
Should the injected dependency be a Protocol or an abstract base class?
Neither, until a second implementation exists. Once it does, a Protocol is the better fit for this round: it is structural, so the fake in your test satisfies it by having the right methods and never mentions the protocol at all. An abstract base class forces the fake to inherit, which is one more line in the test and one more thing to explain. Say the reasoning out loud when you write it, because the interviewer is scoring the judgement more than the syntax.
How many tests should I write, and when?
Two or three per stage, written as you finish each stage rather than at the end. The normal path, the exact boundary, and one rejected input cover most of what an interviewer wants to see. Name each test as a sentence about behaviour, because the name is the specification and it is read out loud when it fails. Every test shown on this page is run by the build, so none of them is a sketch of a test.
Will match on an Enum read as showing off?
Not when the set of states is closed and every branch returns. Written that way, a type checker proves the match covers every member, so adding a state breaks the build at the match instead of silently taking a default branch. It reads badly in two places: when the subject is a value rather than a state, and when the cases are not exhaustive, because then it is an if-chain with unfamiliar punctuation. It needs Python 3.10 or newer.
What do I drop first when the clock runs out?
Drop the extras in this order: slots, the Protocol, the type alias, docstrings, and then tests beyond the three that matter. What never goes is the type hints on public signatures, the frozen value type for anything used as a key, the guard clauses at the boundary, and a specific exception instead of a sentinel return. Those four are what a reviewer reads first, and each one is a single line at the moment you need it rather than a rewrite later.