Fix tests when running under "python -OO" (PYTHONOPTIMIZE set to 1 or 2)