BUG: optimize: fix botched test for scalars

Any row-vector or other ndarray with shape[0] == 0 was passed through.
actually you could use `assert_raises` as a context manager:
```
with assert_raises(ValueError) as cm:
    optimize.fminbound(self.fun, np.zeros((1, 2)), 1)
assert_in('must be a scalar', str(cm.exception))
```