replace assert type(x) is y by assert isinstance(x, y) statements