The best thing to do when buying a engine is a compression test.
It is not intrusive to the engine and a owner with nothing to hide will normally consent to this test and if he won't then I walk away.
A compression test is not always possible so I would try to buy as a "pig in a poke" not knowing the condition etc., unless the owner offers a warranty that I am not going to find anything major when I do get it running.
Most good wrecking yards offer a "return for exchange" policy.
Just my thoughts on the subject.
Hobert