mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Fixed issue #526.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
# -*- coding: utf-8 # This file contains Unicode characters.
|
||||
|
||||
from io import StringIO
|
||||
from token import NEWLINE, STRING
|
||||
|
||||
from jedi._compatibility import u
|
||||
from jedi._compatibility import u, is_py3
|
||||
from jedi.parser.token import NAME
|
||||
from jedi import parser
|
||||
|
||||
|
||||
from ..helpers import unittest
|
||||
|
||||
|
||||
@@ -73,6 +77,24 @@ asdfasdf""" + "h"
|
||||
if value == 'if':
|
||||
self.assertEqual(prefix, ' ')
|
||||
|
||||
def test_identifier_contains_unicode(self):
|
||||
fundef = u('''
|
||||
def 我あφ():
|
||||
pass
|
||||
''')
|
||||
fundef_io = StringIO(fundef)
|
||||
if is_py3:
|
||||
tokens = parser.tokenize.generate_tokens(fundef_io.readline)
|
||||
token_list = list(tokens)
|
||||
identifier_token = next(
|
||||
(token for token in token_list if token[1] == '我あφ'),
|
||||
None
|
||||
)
|
||||
self.assertIsNotNone(identifier_token)
|
||||
self.assertEqual(identifier_token[0], NAME)
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
def test_tokenizer_with_string_literal_backslash():
|
||||
import jedi
|
||||
|
||||
Reference in New Issue
Block a user