added type check to look for objects with _getitem_ Fixes #7985

Yes, you need to add the `==` to the assert. Otherwise it just checks that it returns something that isn't false.