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

@asmeurer This is the output 
``` python
>>> c[1].subs(c, {1: 2}) == 2
False
```
and thus we have 
``` python
>>> assert c[1].subs(c, {1: 2}) == 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
```
So instead of checking this we can check the type of 
```
d[1].subs(d, {1: 2})
```
We can do it by comparing it
``` python
>>> isinstance(c[1].subs(c, {1: 2}), type(a[1]))
True
>>> assert isinstance(c[1].subs(c, {1: 2}), type(a[1]))
>>>
```