@pytest.mark.parametrize('formats, issues_warning', [({'p': '%d', 'y': '%f'}, True), ({'x': '%d', 'y': '%f'}, True), ({'z': '%f'}, True), ({}, False)])
def test_columns_names_with_formats(formats, issues_warning):
 t = table.Table([[1, 2, 3], [4.1, 5.2, 6.3]])
 with catch_warnings(AstropyWarning) as ASwarn:
  out = StringIO()
  ascii.write(t, out, formats=formats)
 assert (issues_warning == (len(ASwarn) == 1))

@ pytest . mark . parametrize ( 'formats, issues_warning' , [ ( { 'p' : '%d' , 'y' : '%f' } , True ) , ( { 'x' : '%d' , 'y' : '%f' } , True ) , ( { 'z' : '%f' } , True ) , ( { } , False ) ] ) def test_columns_names_with_formats ( formats , issues_warning ) : t = table . Table ( [ [ 1 , 2 , 3 ] , [ 4.1 , 5.2 , 6.3 ] ] ) with catch_warnings ( AstropyWarning ) as ASwarn : out = StringIO ( ) ascii . write ( t , out , formats = formats ) assert ( issues_warning == ( len ( ASwarn ) == 1 ) )
test the fix for #4508 .