mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Remove most version_info.major usages
This commit is contained in:
@@ -125,7 +125,7 @@ def test_get_signatures_whitespace(Script):
|
||||
abs(
|
||||
def x():
|
||||
pass
|
||||
""")
|
||||
""") # noqa
|
||||
assert_signature(Script, s, 'abs', 0, line=1, column=5)
|
||||
|
||||
|
||||
@@ -239,13 +239,12 @@ def test_complex(Script, environment):
|
||||
func1, = sig1._name.infer()
|
||||
func2, = sig2._name.infer()
|
||||
|
||||
if environment.version_info.major == 3:
|
||||
# Do these checks just for Python 3, I'm too lazy to deal with this
|
||||
# legacy stuff. ~ dave.
|
||||
assert get_signature(func1.tree_node) \
|
||||
== 'compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]'
|
||||
assert get_signature(func2.tree_node) \
|
||||
== 'compile(pattern: Pattern[AnyStr], flags: _FlagsType = ...) ->\nPattern[AnyStr]'
|
||||
# Do these checks just for Python 3, I'm too lazy to deal with this
|
||||
# legacy stuff. ~ dave.
|
||||
assert get_signature(func1.tree_node) \
|
||||
== 'compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]'
|
||||
assert get_signature(func2.tree_node) \
|
||||
== 'compile(pattern: Pattern[AnyStr], flags: _FlagsType = ...) ->\nPattern[AnyStr]'
|
||||
|
||||
# jedi-vim #70
|
||||
s = """def foo("""
|
||||
@@ -373,10 +372,8 @@ def test_keyword_argument_index(Script, environment):
|
||||
def get(source, column=None):
|
||||
return Script(source).get_signatures(column=column)[0]
|
||||
|
||||
# The signature of sorted changed from 2 to 3.
|
||||
py2_offset = int(environment.version_info.major == 2)
|
||||
assert get('sorted([], key=a').index == 1 + py2_offset
|
||||
assert get('sorted([], key=').index == 1 + py2_offset
|
||||
assert get('sorted([], key=a').index == 1
|
||||
assert get('sorted([], key=').index == 1
|
||||
assert get('sorted([], no_key=a').index is None
|
||||
|
||||
kw_func = 'def foo(a, b): pass\nfoo(b=3, a=4)'
|
||||
|
||||
Reference in New Issue
Block a user