def test_user_statement_on_import():
 s = u('from datetime import (\n    time)')
 for pos in [(2, 1), (2, 4)]:
  p = ParserWithRecovery(load_grammar(), s)
  stmt = p.module.get_statement_for_position(pos)
  assert isinstance(stmt, pt.Import)
  assert ([str(n) for n in stmt.get_defined_names()] == ['time'])

def test_user_statement_on_import ( ) : s = u ( 'from datetime import (\n    time)' ) for pos in [ ( 2 , 1 ) , ( 2 , 4 ) ] : p = ParserWithRecovery ( load_grammar ( ) , s ) stmt = p . module . get_statement_for_position ( pos ) assert isinstance ( stmt , pt . Import ) assert ( [ str ( n ) for n in stmt . get_defined_names ( ) ] == [ 'time' ] )
github #285 .