Exemplo n.º 1
0
 def test_filename(self):
     completer = autocomplete.FilenameCompletion()
     last_part_of_filename = completer.format
     self.assertEqual(last_part_of_filename("abc"), "abc")
     self.assertEqual(last_part_of_filename("abc/"), "abc/")
     self.assertEqual(last_part_of_filename("abc/efg"), "efg")
     self.assertEqual(last_part_of_filename("abc/efg/"), "efg/")
     self.assertEqual(last_part_of_filename("/abc"), "abc")
     self.assertEqual(last_part_of_filename("ab.c/e.f.g/"), "e.f.g/")
Exemplo n.º 2
0
 def test_filename(self):
     completer = autocomplete.FilenameCompletion()
     last_part_of_filename = completer.format
     self.assertEqual(last_part_of_filename('abc'), 'abc')
     self.assertEqual(last_part_of_filename('abc/'), 'abc/')
     self.assertEqual(last_part_of_filename('abc/efg'), 'efg')
     self.assertEqual(last_part_of_filename('abc/efg/'), 'efg/')
     self.assertEqual(last_part_of_filename('/abc'), 'abc')
     self.assertEqual(last_part_of_filename('ab.c/e.f.g/'), 'e.f.g/')
Exemplo n.º 3
0
 def test_list_win_not_visible_and_match_selected_if_one_option(self):
     self.repl._current_line = " './a'"
     self.repl._cursor_offset = 5
     with mock.patch('bpython.autocomplete.get_completer_bpython') as m:
         m.return_value = (['./abcd'], autocomplete.FilenameCompletion())
         self.repl.update_completion()
         self.assertEqual(self.repl.list_win_visible, False)
     self.repl.on_tab()
     self.assertEqual(self.repl._current_line, " './abcd'")
     self.assertEqual(self.repl.current_match, None)
     self.assertEqual(self.repl.list_win_visible, False)
Exemplo n.º 4
0
 def test_list_win_visible_match_selected_on_tab_multiple_options(self):
     self.repl._current_line = " './'"
     self.repl._cursor_offset = 2
     with mock.patch('bpython.autocomplete.get_completer_bpython') as m:
         m.return_value = (['./abc', './abcd',
                            './bcd'], autocomplete.FilenameCompletion())
         self.repl.update_completion()
         self.assertEqual(self.repl.list_win_visible, False)
         self.repl.on_tab()
     self.assertEqual(self.repl.current_match, './abc')
     self.assertEqual(self.repl.list_win_visible, True)
Exemplo n.º 5
0
 def test_list_win_not_visible_and_cseq_if_cseq(self):
     self.repl._current_line = " './a'"
     self.repl._cursor_offset = 5
     with mock.patch("bpython.autocomplete.get_completer") as m:
         m.return_value = (
             ["./abcd", "./abce"],
             autocomplete.FilenameCompletion(),
         )
         self.repl.update_completion()
         self.assertEqual(self.repl.list_win_visible, False)
     self.repl.on_tab()
     self.assertEqual(self.repl._current_line, " './abc'")
     self.assertEqual(self.repl.current_match, None)
     self.assertEqual(self.repl.list_win_visible, False)
Exemplo n.º 6
0
 def setUp(self):
     self.completer = autocomplete.FilenameCompletion()