diff options
author | w0rp <devw0rp@gmail.com> | 2019-05-12 19:35:10 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-05-12 19:35:10 +0100 |
commit | bfc79bd2aafffc9b8590f9ffa68254243e3f808a (patch) | |
tree | 61b01402125c60ea9ffdfebb67795e0809f736f1 /test/python/test_deoplete_source.py | |
parent | 7943bfab96ea1ecc169e815f75062cc127192ed8 (diff) | |
download | ale-bfc79bd2aafffc9b8590f9ffa68254243e3f808a.zip |
#2492 - Try to fix a deoplete bug again
Diffstat (limited to 'test/python/test_deoplete_source.py')
-rw-r--r-- | test/python/test_deoplete_source.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/test/python/test_deoplete_source.py b/test/python/test_deoplete_source.py index 94fa66c2..28eec5cd 100644 --- a/test/python/test_deoplete_source.py +++ b/test/python/test_deoplete_source.py @@ -23,7 +23,7 @@ class DeopleteSourceTest(unittest.TestCase): super(DeopleteSourceTest, self).setUp() self.call_list = [] - self.call_results = {} + self.call_results = {'ale#completion#CanProvideCompletions': 1} self.source = ale_module.Source('vim') self.source.vim = VimMock(self.call_list, self.call_results) @@ -59,27 +59,41 @@ class DeopleteSourceTest(unittest.TestCase): def test_request_completion_results(self): context = {'is_async': False} - self.assertIsNone(self.source.gather_candidates(context)) + self.assertEqual(self.source.gather_candidates(context), []) self.assertEqual(context, {'is_async': True}) self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletions', ('deoplete',)), ]) + def test_request_completion_results_from_buffer_without_providers(self): + self.call_results['ale#completion#CanProvideCompletions'] = 0 + context = {'is_async': False} + + self.assertIsNone(self.source.gather_candidates(context), []) + self.assertEqual(context, {'is_async': False}) + self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), + ]) + def test_refresh_completion_results(self): context = {'is_async': False} - self.assertIsNone(self.source.gather_candidates(context)) + self.assertEqual(self.source.gather_candidates(context), []) self.assertEqual(context, {'is_async': True}) self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletions', ('deoplete',)), ]) context = {'is_async': True, 'is_refresh': True} - self.assertIsNone(self.source.gather_candidates(context)) + self.assertEqual(self.source.gather_candidates(context), []) self.assertEqual(context, {'is_async': True, 'is_refresh': True}) self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletions', ('deoplete',)), + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletions', ('deoplete',)), ]) @@ -87,9 +101,10 @@ class DeopleteSourceTest(unittest.TestCase): context = {'is_async': True} self.call_results['ale#completion#GetCompletionResult'] = None - self.assertIsNone(self.source.gather_candidates(context)) + self.assertEqual(self.source.gather_candidates(context), []) self.assertEqual(context, {'is_async': True}) self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletionResult', ()), ]) @@ -100,6 +115,7 @@ class DeopleteSourceTest(unittest.TestCase): self.assertEqual(self.source.gather_candidates(context), []) self.assertEqual(context, {'is_async': False}) self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletionResult', ()), ]) @@ -126,5 +142,6 @@ class DeopleteSourceTest(unittest.TestCase): ]) self.assertEqual(context, {'is_async': False}) self.assertEqual(self.call_list, [ + ('ale#completion#CanProvideCompletions', ()), ('ale#completion#GetCompletionResult', ()), ]) |