Moved redundant testing code to astropy/tests/helper.py, replaced dump/load with dumps/loads.