@@ -379,6 +379,25 @@ def test_path_completion_directories_only(request):
379379
380380 assert path_complete (text , line , begidx , endidx , dir_only = True ) == ['scripts' + os .path .sep ]
381381
382+ def test_path_completion_syntax_err (request ):
383+ test_dir = os .path .dirname (request .module .__file__ )
384+
385+ text = 'c'
386+ path = os .path .join (test_dir , text )
387+ line = 'shell cat " {}' .format (path )
388+
389+ endidx = len (line )
390+ begidx = endidx - len (text )
391+
392+ assert path_complete (text , line , begidx , endidx ) == []
393+
394+ def test_path_completion_no_tokens ():
395+ text = ''
396+ line = 'shell'
397+ endidx = len (line )
398+ begidx = endidx - len (text )
399+ assert path_complete (text , line , begidx , endidx ) == []
400+
382401
383402# List of strings used with flag and index based completion functions
384403food_item_strs = ['Pizza' , 'Hamburger' , 'Ham' , 'Potato' ]
@@ -457,6 +476,15 @@ def test_flag_based_completion_syntax_err():
457476
458477 assert flag_based_complete (text , line , begidx , endidx , flag_dict ) == []
459478
479+ def test_flag_based_completion_no_tokens ():
480+ text = ''
481+ line = 'list_food'
482+ endidx = len (line )
483+ begidx = endidx - len (text )
484+
485+ assert flag_based_complete (text , line , begidx , endidx , flag_dict ) == []
486+
487+
460488# Dictionary used with index based completion functions
461489index_dict = \
462490 {
0 commit comments