def test_follow_import_incomplete():
 datetime = check_follow_definition_types('import itertool')
 assert (datetime == ['module'])
 itert = jedi.Script('from itertools import ').completions()
 definitions = [d for d in itert if (d.name == 'chain')]
 assert (len(definitions) == 1)
 assert ([d.type for d in definitions[0].follow_definition()] == ['class'])
 datetime = check_follow_definition_types('from datetime import datetim')
 assert (set(datetime) == set(['class', 'instance']))
 ospath = check_follow_definition_types('from os.path import abspat')
 assert (ospath == ['function'])
 alias = check_follow_definition_types('import io as abcd; abcd')
 assert (alias == ['module'])

def test_follow_import_incomplete ( ) : datetime = check_follow_definition_types ( 'import itertool' ) assert ( datetime == [ 'module' ] ) itert = jedi . Script ( 'from itertools import ' ) . completions ( ) definitions = [ d for d in itert if ( d . name == 'chain' ) ] assert ( len ( definitions ) == 1 ) assert ( [ d . type for d in definitions [ 0 ] . follow_definition ( ) ] == [ 'class' ] ) datetime = check_follow_definition_types ( 'from datetime import datetim' ) assert ( set ( datetime ) == set ( [ 'class' , 'instance' ] ) ) ospath = check_follow_definition_types ( 'from os.path import abspat' ) assert ( ospath == [ 'function' ] ) alias = check_follow_definition_types ( 'import io as abcd; abcd' ) assert ( alias == [ 'module' ] )
completion on incomplete imports should always take the full completion to do any evaluation .