def test_replace_column_qtable():
 a = ([1, 2, 3] * u.m)
 b = [4, 5, 6]
 t = table.QTable([a, b], names=['a', 'b'])
 ta = t['a']
 tb = t['b']
 ta.info.meta = {'aa': [0, 1, 2, 3, 4]}
 ta.info.format = '%f'
 t.replace_column('a', a.to('cm'))
 assert np.all((t['a'] == ta))
 assert (t['a'] is not ta)
 assert (t['b'] is tb)
 assert (t.colnames == ['a', 'b'])
 assert (t['a'].info.meta is None)
 assert (t['a'].info.format is None)

def test_replace_column_qtable ( ) : a = ( [ 1 , 2 , 3 ] * u . m ) b = [ 4 , 5 , 6 ] t = table . QTable ( [ a , b ] , names = [ 'a' , 'b' ] ) ta = t [ 'a' ] tb = t [ 'b' ] ta . info . meta = { 'aa' : [ 0 , 1 , 2 , 3 , 4 ] } ta . info . format = '%f' t . replace_column ( 'a' , a . to ( 'cm' ) ) assert np . all ( ( t [ 'a' ] == ta ) ) assert ( t [ 'a' ] is not ta ) assert ( t [ 'b' ] is tb ) assert ( t . colnames == [ 'a' , 'b' ] ) assert ( t [ 'a' ] . info . meta is None ) assert ( t [ 'a' ] . info . format is None )
replace existing quantity column with a new column in a qtable .