Пример #1
0
    def test_completer(self):
        # Test path
        completer = Completer(get_file=False)
        self.assertEqual(completer.complete_path('/bin/'), [])
        self.assertEqual(completer.path_complete(['/bin']), [])
        self.assertEqual(completer.path_complete(), [])
        self.assertEqual(completer.complete_path(''), [])
        self.assertEqual(completer.complete_path('/bin/sh'), ['/bin/sh '])
        self.assertNotEqual(completer.listdir('/etc/'), [])

        # Test file
        completer = Completer(get_file=True)
        self.assertTrue(len(completer.complete_path('/bin/')) > 0)
        self.assertTrue(completer.complete('', 0))
Пример #2
0
    def test_completer(self) -> None:
        # Test path
        completer = Completer(get_file=False)
        self.assertEqual(completer.complete_path('outer/'),       ['outer/middle/'])
        self.assertEqual(completer.path_complete(['/outer']),     [])
        self.assertEqual(completer.path_complete(),               ['./outer/'])
        self.assertEqual(completer.complete_path(''),             ['outer/'])
        self.assertEqual(completer.complete_path('outer/middle'), ['outer/middle/inner/'])
        self.assertEqual(completer.complete_path('outer/file'),   ['outer/file '])
        self.assertNotEqual(completer.listdir('outer/'),          [])

        # Test file
        completer = Completer(get_file=True)
        self.assertTrue(len(completer.complete_path('/bin/')) > 0)
        self.assertTrue(completer.complete('', 0))