Replaced unittest.AssertRaises with numpy equivalent.