def test_unicode_column(tmpdir):
 t = Table([np.array([u'a', u'b', u'cd'])])
 t.write(str(tmpdir.join('test.fits')), overwrite=True)
 with fits.open(str(tmpdir.join('test.fits'))) as hdul:
  assert np.all((hdul[1].data['col0'] == ['a', 'b', 'cd']))
  assert (hdul[1].header['TFORM1'] == '2A')
 t2 = Table([np.array([u'\u2603'])])
 with pytest.raises(UnicodeEncodeError):
  t2.write(str(tmpdir.join('test.fits')), overwrite=True)

def test_unicode_column ( tmpdir ) : t = Table ( [ np . array ( [ u'a' , u'b' , u'cd' ] ) ] ) t . write ( str ( tmpdir . join ( 'test.fits' ) ) , overwrite = True ) with fits . open ( str ( tmpdir . join ( 'test.fits' ) ) ) as hdul : assert np . all ( ( hdul [ 1 ] . data [ 'col0' ] == [ 'a' , 'b' , 'cd' ] ) ) assert ( hdul [ 1 ] . header [ 'TFORM1' ] == '2A' ) t2 = Table ( [ np . array ( [ u'\u2603' ] ) ] ) with pytest . raises ( UnicodeEncodeError ) : t2 . write ( str ( tmpdir . join ( 'test.fits' ) ) , overwrite = True )
test that a column of unicode strings is still written as one byte-per-character in the fits table .