def test_table_with_no_newline():
 table = BytesIO()
 with pytest.raises(ascii.InconsistentTableError):
  ascii.read(table)
 table = BytesIO()
 with pytest.raises(ValueError) as err:
  ascii.read(table, guess=False, fast_reader=False, format='basic')
 assert ('No header line found' in str(err.value))
 table = BytesIO()
 with pytest.raises(ValueError) as err:
  ascii.read(table, guess=False, fast_reader=True, format='fast_basic')
 assert ('Inconsistent data column lengths' in str(err.value))
 for kwargs in [dict(), dict(guess=False, fast_reader=False, format='basic'), dict(guess=False, fast_reader=True, format='fast_basic')]:
  table = BytesIO()
  table.write('a b')
  t = ascii.read(table, **kwargs)
  assert (t.colnames == ['a', 'b'])
  assert (len(t) == 0)

def test_table_with_no_newline ( ) : table = BytesIO ( ) with pytest . raises ( ascii . InconsistentTableError ) : ascii . read ( table ) table = BytesIO ( ) with pytest . raises ( ValueError ) as err : ascii . read ( table , guess = False , fast_reader = False , format = 'basic' ) assert ( 'No header line found' in str ( err . value ) ) table = BytesIO ( ) with pytest . raises ( ValueError ) as err : ascii . read ( table , guess = False , fast_reader = True , format = 'fast_basic' ) assert ( 'Inconsistent data column lengths' in str ( err . value ) ) for kwargs in [ dict ( ) , dict ( guess = False , fast_reader = False , format = 'basic' ) , dict ( guess = False , fast_reader = True , format = 'fast_basic' ) ] : table = BytesIO ( ) table . write ( 'a b' ) t = ascii . read ( table , ** kwargs ) assert ( t . colnames == [ 'a' , 'b' ] ) assert ( len ( t ) == 0 )
test that an input file which is completely empty fails in the expected way .