My attitude is that take-home tests should be given to candidates if they cannot share work they've already done.
This creates a win-win incentive because it would become standard in our industry to have a portfolio of GitHub contributions, a stack overflow profile, etc. At least those artefacts are helpful to a wider community as well as showing your abilities.
Couple this with an open ended technical conversation with the engineer, progressively drilling down on items they know about to see the depth of their skillset, you will understand the key skills they can present for the job opportunity.