def test_latex_units():
 t = table.Table([table.Column(name='date', data=['a', 'b']), table.Column(name='NUV exp.time', data=[1, 2])])
 latexdict = copy.deepcopy(ascii.latexdicts['AA'])
 latexdict['units'] = {'NUV exp.time': 's'}
 out = StringIO()
 expected = '\\begin{table}{cc}\n\\tablehead{\\colhead{date} & \\colhead{NUV exp.time}\\\\ \\colhead{ } & \\colhead{s}}\n\\startdata\na & 1 \\\\\nb & 2\n\\enddata\n\\end{table}\n'.replace('\n', os.linesep)
 ascii.write(t, out, format='aastex', latexdict=latexdict)
 assert (out.getvalue() == expected)
 t['NUV exp.time'].unit = units.s
 t['date'].unit = units.yr
 out = StringIO()
 ascii.write(t, out, format='aastex', latexdict=ascii.latexdicts['AA'])
 assert (out.getvalue() == expected.replace('colhead{s}', 'colhead{$\\mathrm{s}$}').replace('colhead{ }', 'colhead{$\\mathrm{yr}$}'))

def test_latex_units ( ) : t = table . Table ( [ table . Column ( name = 'date' , data = [ 'a' , 'b' ] ) , table . Column ( name = 'NUV exp.time' , data = [ 1 , 2 ] ) ] ) latexdict = copy . deepcopy ( ascii . latexdicts [ 'AA' ] ) latexdict [ 'units' ] = { 'NUV exp.time' : 's' } out = StringIO ( ) expected = '\\begin{table}{cc}\n\\tablehead{\\colhead{date} & \\colhead{NUV exp.time}\\\\ \\colhead{ } & \\colhead{s}}\n\\startdata\na & 1 \\\\\nb & 2\n\\enddata\n\\end{table}\n' . replace ( '\n' , os . linesep ) ascii . write ( t , out , format = 'aastex' , latexdict = latexdict ) assert ( out . getvalue ( ) == expected ) t [ 'NUV exp.time' ] . unit = units . s t [ 'date' ] . unit = units . yr out = StringIO ( ) ascii . write ( t , out , format = 'aastex' , latexdict = ascii . latexdicts [ 'AA' ] ) assert ( out . getvalue ( ) == expected . replace ( 'colhead{s}' , 'colhead{$\\mathrm{s}$}' ) . replace ( 'colhead{ }' , 'colhead{$\\mathrm{yr}$}' ) )
check to make sure that latex and aastex writers attempt to fall back on the **unit** attribute of **column** if the supplied **latexdict** does not specify units .