refactor almost identical tests (#6339)
refactor almost identical tests (#6339)

* refactor almost identical tests

* important to add a clear assert error message

* make the assert error even more descriptive than the original bt
huggingface/transformers,huggingface/transformers,huggingface/transformers,huggingface/pytorch-transformers,huggingface/transformers