Skip to content
Snippets Groups Projects
Commit 88b0c2b7 authored by Laurent Peuch's avatar Laurent Peuch Committed by GitHub
Browse files

Merge pull request #102 from Ahuge/master

Updated the indentation marker to not fail on len 3 lexer tokens.
parents 02c9b46c 5c8330b2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -35,7 +35,7 @@ def get_space(node):
a ('ENDL', '\n') node - then we return None as a flag value. This is
maybe not the best behavior but it seems to work for now.
"""
if len(node) < 3 or len(node[3]) == 0:
if len(node) < 4 or len(node[3]) == 0:
return None
return transform_tabs_to_spaces(node[3][0][1])
 
Loading
Loading
Loading
Loading
@@ -46,6 +46,35 @@ def test_dumy_if():
])
 
 
def test_dumy_def_space():
"""
def foo():
pass
"""
# https://github.com/PyCQA/baron/issues/101
check([
('DEF', 'def', [], [('SPACE', ' ')]),
('NAME', 'foo'),
('LEFT_PARENTHESIS', '('),
('RIGHT_PARENTHESIS', ')'),
('COLON', ':'),
('ENDL', '\n', [], [('SPACE', ' ')]),
('PASS', 'pass'),
('ENDL', '\n', [('SPACE', ' ')]),
], [
('DEF', 'def', [], [('SPACE', ' ')]),
('NAME', 'foo'),
('LEFT_PARENTHESIS', '('),
('RIGHT_PARENTHESIS', ')'),
('COLON', ':'),
('ENDL', '\n', [], [('SPACE', ' ')]),
('INDENT', ''),
('PASS', 'pass'),
('ENDL', '\n', [('SPACE', ' ')]),
('DEDENT', ''),
])
def test_dumy_if_if():
"""
if a:
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment