Merge branch 'dev' of github.com:davidhalter/jedi into dev

This commit is contained in:
Dave Halter
2014-07-27 09:44:25 +02:00
6 changed files with 38 additions and 22 deletions
+13
View File
@@ -153,3 +153,16 @@ import json
json.load('asdf') json.load('asdf')
#? #?
json.loads('[1]') json.loads('[1]')
# -----------------
# random
# -----------------
import random
class A(object):
def say(self): pass
class B(object):
def shout(self): pass
cls = random.choice([A, B])
#? ['say', 'shout']
cls().s
+5 -2
View File
@@ -236,7 +236,7 @@ def collect_file_tests(lines, lines_to_execute):
correct = None correct = None
test_type = None test_type = None
for line_nr, line in enumerate(lines, 1): for line_nr, line in enumerate(lines, 1):
if correct: if correct is not None:
r = re.match('^(\d+)\s*(.*)$', correct) r = re.match('^(\d+)\s*(.*)$', correct)
if r: if r:
column = int(r.group(1)) column = int(r.group(1))
@@ -255,10 +255,13 @@ def collect_file_tests(lines, lines_to_execute):
correct = None correct = None
else: else:
try: try:
r = re.search(r'(?:^|(?<=\s))#([?!<])\s*([^\n]+)', line) r = re.search(r'(?:^|(?<=\s))#([?!<])\s*([^\n]*)', line)
# test_type is ? for completion and ! for goto_assignments # test_type is ? for completion and ! for goto_assignments
test_type = r.group(1) test_type = r.group(1)
correct = r.group(2) correct = r.group(2)
# Quick hack to make everything work (not quite a bloody unicorn hack though).
if correct == '':
correct = ' '
start = r.start() start = r.start()
except AttributeError: except AttributeError:
correct = None correct = None