Skip to content

Commit

Permalink
Merge from 3.x: PR #6681
Browse files Browse the repository at this point in the history
Fixes #6520
  • Loading branch information
ccordoba12 committed Mar 8, 2018
2 parents bf442ca + 28cfc3e commit 74265d2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion spyder/utils/codeanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def find_tasks(source_code):
results = []
for line, text in enumerate(source_code.splitlines()):
for todo in re.findall(TASKS_PATTERN, text):
results.append((todo[-1].strip().capitalize(), line+1))
todo_text = (todo[-1].strip(' :').capitalize() if todo[-1]
else todo[-2])
results.append((todo_text, line + 1))
return results


Expand Down
3 changes: 3 additions & 0 deletions spyder/utils/tests/data/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

import numpy as np

# TODO test
# XXX

print (__file__)

def iterate_1(Z):
Expand Down
4 changes: 2 additions & 2 deletions spyder/utils/tests/test_codeanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def test_codeanalysis():
check_results = check_with_pyflakes(code, TEST_FILE) + \
check_with_pep8(code, TEST_FILE) + find_tasks(code)
if PY2:
num_results = 87
num_results = 89
else:
num_results = 88
num_results = 90
assert len(check_results) == num_results


Expand Down
2 changes: 1 addition & 1 deletion spyder/utils/tests/test_get_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_get_words_python():
'com', 'def', 'for', 'gmail', 'home', 'i', 'implemented', 'import',
'in', 'int', 'is', 'iterate_', 'jmg', 'neighbours', 'new', 'np', 'null',
'numpy', 'over', 'print', 'range', 'ravel', 'return', 'rules', 'shape',
'stay', 'sure', 'survive', 'utn', 'values', 'zeros']
'stay', 'sure', 'survive', 'test', 'TODO', 'utn', 'values', 'XXX', 'zeros']
assert sorted(expected_words) == sorted(get_words_by_filename("example.py"))
assert sorted(expected_words) == sorted(get_words_by_content("example.py"))

Expand Down

0 comments on commit 74265d2

Please sign in to comment.