[4.2] Tests : assertInstanceOf

Use `assertInstanceOf`

This PR comes with other PR: #5333 #5334 #5336 #5337 
They are split for review and readability purpose.
@taylorotwell , let me know if you prefer a global PR with all the changes instead of separate PR