AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

Avoid try-catch in tests

Open albinahlback opened this issue 8 months ago • 2 comments

The issue https://github.com/Nemocas/Nemo.jl/issues/2012 is related to a try-catch statement in ConformanceTests. I think it's a very bad idea to use try-catch statements as they just mask problems, in particular in tests.

On a broader front, it looks like they are used extensively in Oscar. Why is it used so extensively?

albinahlback avatar Mar 31 '25 13:03 albinahlback

Generating some opinions before starting to poke around in the code. Ping @fieker @fingolfin @thofma

albinahlback avatar Mar 31 '25 13:03 albinahlback

Bill introduced them as a clever way to try fast algorithms - that may fail - first, think some nmod/ fmpz_mod stuff that might fail if non-units are encountered and are correct otherwise. Then the catch will invoke the slow, but safe method.

Other use case are modular algorithms where I do not know beforehand that the projection to GF(p) is going to work. I think real-lll is also doing this to signal not enough precision

But yes, we were bitten before when we did not carefully catch the correct error...

fieker avatar Apr 01 '25 06:04 fieker