@pytest.mark.skipif('not HAS_YAML')
def test_ecsv_astropy_objects_in_meta():
 t = QTable([([1, 2] * u.m), [4, 5]], names=['a', 'b'])
 tm = _get_time()
 c = SkyCoord([[1, 2], [3, 4]], [[5, 6], [7, 8]], unit='deg', frame='fk4', obstime=Time('2016-01-02'), location=EarthLocation(1000, 2000, 3000, unit=u.km))
 unit = (u.m / u.s)
 t.meta = {'tm': tm, 'c': c, 'unit': unit}
 out = StringIO()
 t.write(out, format='ascii.ecsv')
 t2 = QTable.read(out.getvalue(), format='ascii.ecsv')
 compare_time(tm, t2.meta['tm'])
 compare_coord(c, t2.meta['c'])
 assert (t2.meta['unit'] == unit)

@ pytest . mark . skipif ( 'not HAS_YAML' ) def test_ecsv_astropy_objects_in_meta ( ) : t = QTable ( [ ( [ 1 , 2 ] * u . m ) , [ 4 , 5 ] ] , names = [ 'a' , 'b' ] ) tm = _get_time ( ) c = SkyCoord ( [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , unit = 'deg' , frame = 'fk4' , obstime = Time ( '2016-01-02' ) , location = EarthLocation ( 1000 , 2000 , 3000 , unit = u . km ) ) unit = ( u . m / u . s ) t . meta = { 'tm' : tm , 'c' : c , 'unit' : unit } out = StringIO ( ) t . write ( out , format = 'ascii.ecsv' ) t2 = QTable . read ( out . getvalue ( ) , format = 'ascii.ecsv' ) compare_time ( tm , t2 . meta [ 'tm' ] ) compare_coord ( c , t2 . meta [ 'c' ] ) assert ( t2 . meta [ 'unit' ] == unit )
test that astropy core objects in meta are serialized .