예제 #1
0
 def matches_from_completions(self, cursor, line, block, history,
                              completions):
     with mock.patch('bpython.autocomplete.jedi.Script') as Script:
         script = Script.return_value
         script.completions.return_value = completions
         com = autocomplete.MultilineJediCompletion()
         return com.matches(cursor, line, block, history)
예제 #2
0
 def test_returns_non_with_blank_second_line(self):
     com = autocomplete.MultilineJediCompletion()
     self.assertEqual(
         com.matches(0,
                     '',
                     current_block='class Foo():\n',
                     history=['class Foo():']), None)
예제 #3
0
 def test_issue_544(self):
     com = autocomplete.MultilineJediCompletion()
     code = "@asyncio.coroutine\ndef"
     history = ("import asyncio", "@asyncio.coroutin")
     com.matches(3, "def", current_block=code, history=history)
예제 #4
0
 def test_returns_none_with_single_line(self):
     com = autocomplete.MultilineJediCompletion()
     self.assertEqual(com.matches(2, "Va", current_block="Va", history=[]),
                      None)
예제 #5
0
 def test_returns_none_with_single_line(self):
     com = autocomplete.MultilineJediCompletion()
     self.assertEqual(com.matches(2, 'Va', 'Va', []), None)
예제 #6
0
 def test_issue_544(self):
     com = autocomplete.MultilineJediCompletion()
     code = '@asyncio.coroutine\ndef'
     history = ('import asyncio', '@asyncio.coroutin')
     com.matches(3, 'def', current_block=code, history=history)