BUG: optimize: fix botched test for scalars

Any row-vector or other ndarray with shape[0] == 1 was passed through.
Lars Buitinck wrote:
> Reconstructed and pushed.

Thanks @larsmans. Now I see the issue.
So I'd suggest to either import `assert_raises` from `nose.tools` 
directly or go back to the try/except form you suggested before but with 
a `raise AssertionError(...)`.