Fixed #14334 -- Query comparision now check for object types.

Either "It checks whether..." or "If not, raises a ValueError..." (i.e. `it` should be either in both cases or in none).