forked from VimPlug/jedi
Changed a tokenize test to match the current intended behavior of the tokenizer.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 # This file contains Unicode characters.
|
# -*- coding: utf-8 # This file contains Unicode characters.
|
||||||
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from token import NEWLINE, STRING
|
from token import NEWLINE, STRING, INDENT
|
||||||
|
|
||||||
from jedi._compatibility import u, is_py3
|
from jedi._compatibility import u, is_py3
|
||||||
from jedi.parser.token import NAME
|
from jedi.parser.token import NAME
|
||||||
@@ -45,13 +45,14 @@ asdfasdf""" + "h"
|
|||||||
simple_docstring_io = StringIO(simple_docstring)
|
simple_docstring_io = StringIO(simple_docstring)
|
||||||
tokens = parser.tokenize.generate_tokens(simple_docstring_io.readline)
|
tokens = parser.tokenize.generate_tokens(simple_docstring_io.readline)
|
||||||
token_list = list(tokens)
|
token_list = list(tokens)
|
||||||
typ, value, start_pos, prefix = token_list[0]
|
assert token_list[0][0] == INDENT
|
||||||
self.assertEqual(prefix, ' ')
|
|
||||||
self.assertEqual(value, '"""simple one line docstring"""')
|
|
||||||
self.assertEqual(typ, STRING)
|
|
||||||
typ, value, start_pos, prefix = token_list[1]
|
typ, value, start_pos, prefix = token_list[1]
|
||||||
self.assertEqual(prefix, ' ')
|
assert prefix == ' '
|
||||||
self.assertEqual(typ, NEWLINE)
|
assert value == '"""simple one line docstring"""'
|
||||||
|
assert typ == STRING
|
||||||
|
typ, value, start_pos, prefix = token_list[2]
|
||||||
|
assert prefix == ' '
|
||||||
|
assert typ == NEWLINE
|
||||||
|
|
||||||
def test_function_whitespace(self):
|
def test_function_whitespace(self):
|
||||||
# Test function definition whitespace identification
|
# Test function definition whitespace identification
|
||||||
|
|||||||
Reference in New Issue
Block a user