@pytest.mark.parametrize('fast_writer', [True, False])
def test_write_comments(fast_writer):
 data = ascii.read('#c1\n  # c2 DCTB \na,b,c\n#  c3\n1,2,3')
 out = StringIO()
 ascii.write(data, out, format='basic', fast_writer=fast_writer)
 expected = ['# c1', '# c2', '# c3', 'a b c', '1 2 3']
 assert (out.getvalue().splitlines() == expected)
 out = StringIO()
 ascii.write(data, out, format='commented_header', fast_writer=fast_writer)
 expected = ['# a b c', '# c1', '# c2', '# c3', '1 2 3']
 assert (out.getvalue().splitlines() == expected)
 out = StringIO()
 ascii.write(data, out, format='basic', comment=False, fast_writer=fast_writer)
 expected = ['a b c', '1 2 3']
 assert (out.getvalue().splitlines() == expected)

@ pytest . mark . parametrize ( 'fast_writer' , [ True , False ] ) def test_write_comments ( fast_writer ) : data = ascii . read ( '#c1\n  # c2 DCTB \na,b,c\n#  c3\n1,2,3' ) out = StringIO ( ) ascii . write ( data , out , format = 'basic' , fast_writer = fast_writer ) expected = [ '# c1' , '# c2' , '# c3' , 'a b c' , '1 2 3' ] assert ( out . getvalue ( ) . splitlines ( ) == expected ) out = StringIO ( ) ascii . write ( data , out , format = 'commented_header' , fast_writer = fast_writer ) expected = [ '# a b c' , '# c1' , '# c2' , '# c3' , '1 2 3' ] assert ( out . getvalue ( ) . splitlines ( ) == expected ) out = StringIO ( ) ascii . write ( data , out , format = 'basic' , comment = False , fast_writer = fast_writer ) expected = [ 'a b c' , '1 2 3' ] assert ( out . getvalue ( ) . splitlines ( ) == expected )
write comments in output originally read by io .