Update tests and exception message.

The exception is also raised for `Panel` but not for `Series` objects.

Fixes #7813.