@pytest.mark.parametrize('fmt_name_class', fmt_name_classes)
def test_roundtrip_masked(fmt_name_class):
 (fmt_name, fmt_cls) = fmt_name_class
 if (not getattr(fmt_cls, '_io_registry_can_write', True)):
  return
 if (((fmt_name == 'html') and (not HAS_BEAUTIFUL_SOUP)) or (fmt_name == 'fixed_width')):
  return
 t = simple_table(masked=True)
 out = StringIO()
 fast = (fmt_name in ascii.core.FAST_CLASSES)
 try:
  ascii.write(t, out, format=fmt_name, fast_writer=fast)
 except ImportError:
  return
 kwargs = ({'names': t.colnames} if ('no_header' in fmt_name) else {})
 t2 = ascii.read(out.getvalue(), format=fmt_name, fast_reader=fast, guess=False, **kwargs)
 assert (t.colnames == t2.colnames)
 for (col, col2) in zip(t.itercols(), t2.itercols()):
  assert (col.dtype.kind == col2.dtype.kind)
  assert np.all((col == col2))

@ pytest . mark . parametrize ( 'fmt_name_class' , fmt_name_classes ) def test_roundtrip_masked ( fmt_name_class ) : ( fmt_name , fmt_cls ) = fmt_name_class if ( not getattr ( fmt_cls , '_io_registry_can_write' , True ) ) : return if ( ( ( fmt_name == 'html' ) and ( not HAS_BEAUTIFUL_SOUP ) ) or ( fmt_name == 'fixed_width' ) ) : return t = simple_table ( masked = True ) out = StringIO ( ) fast = ( fmt_name in ascii . core . FAST_CLASSES ) try : ascii . write ( t , out , format = fmt_name , fast_writer = fast ) except ImportError : return kwargs = ( { 'names' : t . colnames } if ( 'no_header' in fmt_name ) else { } ) t2 = ascii . read ( out . getvalue ( ) , format = fmt_name , fast_reader = fast , guess = False , ** kwargs ) assert ( t . colnames == t2 . colnames ) for ( col , col2 ) in zip ( t . itercols ( ) , t2 . itercols ( ) ) : assert ( col . dtype . kind == col2 . dtype . kind ) assert np . all ( ( col == col2 ) )
round trip a simple masked table through every writable format and confirm that reading back gives the same result .