fix a test when scipy is not available
Fix test in Python 3.
Enable optimization on numpy interger, not just python int.

This is needed as a previous commit changed some python int to numpy integer.

This will also make the optimization happen more frequently then before.