mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
Fix version differences for re.sub
This commit is contained in:
@@ -108,11 +108,6 @@ for a in re.finditer('a', 'a'):
|
|||||||
#? int()
|
#? int()
|
||||||
a.start()
|
a.start()
|
||||||
|
|
||||||
#?
|
|
||||||
re.sub('a', 'a')
|
|
||||||
#? str() bytes()
|
|
||||||
re.sub('a', 'a', 'f')
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# ref
|
# ref
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
@@ -78,3 +78,26 @@ def test_namedtuple_goto_definitions(Script):
|
|||||||
|
|
||||||
assert d1.get_line_code() == "class Foo(tuple):\n"
|
assert d1.get_line_code() == "class Foo(tuple):\n"
|
||||||
assert d1.module_path is None
|
assert d1.module_path is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_re_sub(Script, environment):
|
||||||
|
"""
|
||||||
|
This whole test was taken out of completion/stdlib.py, because of the
|
||||||
|
version differences.
|
||||||
|
"""
|
||||||
|
def run(code):
|
||||||
|
defs = Script(code).goto_definitions()
|
||||||
|
return {d.name for d in defs}
|
||||||
|
|
||||||
|
names = run("import re; re.sub('a', 'a', 'f')")
|
||||||
|
if environment.version_info.major == 2:
|
||||||
|
assert names == {'str', 'unicode'}
|
||||||
|
else:
|
||||||
|
assert names == {'str', 'bytes'}
|
||||||
|
|
||||||
|
# This param is missing because of overloading.
|
||||||
|
names = run("import re; re.sub('a', 'a')")
|
||||||
|
if environment.version_info.major == 2:
|
||||||
|
assert names == {'str', 'unicode'}
|
||||||
|
else:
|
||||||
|
assert names == {'str', 'bytes'}
|
||||||
|
|||||||
Reference in New Issue
Block a user